ado.net

ADO.NET TableAdapter parameters

I have a query that I wish to run through an ASP.NET TableAdapter that contains an 'IN' clause which is to receive it's values through a parameter. My question is, how do I specify this parameter? I thought of writing the conditional statement like this: AND b.group_category_id in (@ParamList) where the @ParamList is a String of the ...

ADO.Net Entity Framework: What's this?

Hi! I'm just starting developing with ADO.NET Entity Framework and I don't know how I would write this: ClientEntities clientContext = new ClientEntities(); ObjectQuery clientQuery = clientContext.Client.Where("it.email = @email AND it.password = @password", new ObjectParameter("email", "[email protected]...

ADO.NET Entity Framework: Create an Object Using the Static Create Method (C#)

Hi! I wrote this: using (GuiaMovilEntities guiaEntity = new GuiaMovilEntities()) { try { Cliente cliente = Cliente.CreateCliente(-1, datosCliente.Email, datosCliente.Password); } catch { } } It's unfinished. If table Cliente (represented by Cliente object) has its first row (clienteID) as IDENTITY ...

What permission do I need to use SqlBulkCopy in SQL Server 2008?

Using .NET's SqlBulkCopy, what permission do I need to give to the user in SQL Server 2008? ...

Create SQL Database from ADO.NET Typed Dataset

I have a DataSet defined and designed in visual studio. Who knows of a tool to generate tables in SQL Server to match the dataset. ...

Bulk insert questions

I have a CSV file at the client side, and I want to develop a C# application to bulk insert the data into a table of a database to minimal log output. I am confused about if I use ADO.NET at the client side to call stored procedures in the database server. What kind of code needs to develop at the client side and what kind of code needs ...

datatable not knowing its primary key

I'm trying to query a datatable to establish the primary key [identity column], by querying each columns autoincrement property. However its always false (for the column which is the Idenity/PK). Querying the tables primary key collection reveals that the datatable doesn't think it has a PK.; Dim dc As DataColumn() = dt.PrimaryKey ...

Does a IDataReader get automatically get closed when set as a datasource?

When you assign an active IDataReader object to either a Repeater, GridView, etc., does it automatically get closed upon completion of the DataBind method call or do we still need to explicitly close it ourselves? this.sampleRepeater.DataSource = ExampleDAL.GetIDataReader(); this.sampleRepeater.DataBind(); ...

forward mapping with ado.net entity framework

i'm experimenting the entity framework lately, i wonder is it possible to model entities in designer view from scratch then let the framework handle the schema creation, foreign keys and such automatically? ...

performing a select on a c# datatable

Hi, I have a datatable with a bunch of rows in it, the first column is an Int32 and I want to perform a simple select like: select * from MyDataTable where column1 = 234 ...

How to load varbinary(max) fields only when necessary with ADO.NET Entity Framework?

I have a varbinary(max) field in one of my tables but I don't need it every time and I'm looking for a way to fetch it from the database only when necessary. I'm using ADO.NET Entity Framework. How to do that? ...

ADO.NET Data Services, LINQ

Good Day, I have C# code to populate a dropdown list in Silverlight which works fine except when there are duplicates. I think because IEnumerable is a collection, it filters out duplicates. How would I code my LINQ query to accept duplicates? My Sample Data looks like: Code => CodeName FGI      Field General Initiative SRI      Sta...

ADO.NET Entity Framework: QUERY n-n relationships

Hi! I have four tables: Client with PK ClientID. Destination with PK DestinationID. Language with PK LanguageID. DestinationDetail with PK DestinationID. RL-Client-Destination with PKs ClientID and DestinationID. The Client may have zero or n Destinations. A destination has n DestinationDetails, each of these DestinationDetail has a...

Resolve: Use of SqlParameter in SQL LIKE clause not working

I have the following code: sql = "select distinct [name] from tblCustomers left outer join tblCustomerInfo on tblCustomers.Id = tblCustomerInfo.CustomerId where (tblCustomer.Name LIKE '%@SEARCH%' OR tblCustomerInfo.Info LIKE '%@SEARCH%');"; using (SqlCommand command = new SqlCommand(sql, Connection)) { c...

ADO.NET MVC Tutorial (with LINQ to SQL) question about schema changes

So I'm working through the new scottgu wrox book, and I create a couple tables. Then (per the tutorial) I use linq to sql to build my Models, DataCOntext, Repository, etc. (It's pretty clear that LINQ to SQL seems to be "the Microsoft Way" to generate models and similar classes from schemas.) Then I find I've neglected to include one of...

Which values browser collects as a postback data?

hello, When page is to be posted back to the server, browser collects the current values of each control and pastes it together into a string. This postback data is then sent back to the server via HTTP POST. Q1 - Besides control’s Text attributes and SelectedIndexchanged ( thus besides user input data), are there other attributes/valu...

Data source controls and parameter type conversion

Hello, Q1 - In the code example below runtime converts a value between two incompatible types: <SelectParameters> <asp:Parameter Name="City" Type="Int32" /> </SelectParameters> protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e) {e.Command.Parameters["@City"].Value = "100";} Except...

Will Ado.net pass to a stored procedure just the value or also the type?

hello, <asp:SqlDataSource ID="sourceEmployees" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:Northwind %>" SelectCommand="SELECT EmployeeID, FirstName,LastName, Title, City FROM Employees WHERE City=@City"> <SelectParameters> <asp:Parameter Name="Cit...

ConvertEmptyStringToNull property

Hello, A) public void GetEmployee( int EmployeeID ); <asp:ObjectDataSource SelectMethod=”GetEmployee” …> <SelectParameters> <asp:ControlParameter Name = ”EmployeeID” ...> </SelectParameters> If for whatever reason EmployeeID parameter is NULL, ObjectDataSource will convert Null to zero and passed it as argument to GetEmpl...

LINQ to SQL vs ADO.Net

What's the difference between LINQ to SQL and ADO.net ? ...