ado.net

Server Sync Provider and SessionParameters

I'm currently building a custom ServerSyncProvider I've already overrided the GetServerInfo, GetSchema and GetChanges methods, but aparently I'm not getting any session parameters on the server side, like @SyncClientIdHash or @SyncLastReceivedAnchor, that should be kept on the client (I haven't done anything alteration to my SqlCeClientS...

ASP.NET: How to create a connection from a web.config ConnectionString?

How do you construct a DbConnection based on a provider name? Sample provider names System.Data.SqlClient System.Data.OleDb System.Data.Odbc FirebirdSql.Data.FirebirdClient i have connection strings stored in my IIS server's web.config file: <connectionStrings> <add name="development" connectionString="Provider = IBMDA400...

What's the difference between an SQL transaction at the stored procedure level and one at the SqlConnection level?

Say a stored procedure on MSSQL Server uses an SQL transaction using BEGIN TRANSACTION/COMMIT TRANSACTION, how does that differ from beginning and commiting one using ADO.NET via SqlConnection.BeginTransaction()? ...

How do I create an odbcparameter for a sql server xml datatype for an odbccommand object?

So I've got a situation where I need to pass a bunch of data to the server to create a bunch of records. So I read this article and chose the XML method. So I've got the stored procedure all created in sql server 2005. But now I need to call it from asp.net code. Only all I've got for a database connection is an odbcconnection. I se...

Binding query parameters by name with ODP.NET

Hi, I'm currently using the Microsoft ADO.NET provider for Oracle (System.Data.OracleClient). I'm aware that it is certainly not the best Oracle provider available and that it will soon be deprecated, I should be using Oracle's ODP.NET instead. The reason why I still use the MS provider is because ODP.NET binds parameters by position, n...

Transaction commit executes succesfully but not getting done

I've encountered a strange problem in Sql Server. I have a pocket PC application which connects to a web service, which in turn, connects to a database and inserts lots of data. The web service opens a transaction for each pocket PC which connects to it. Everyday at 12 P.M., 15 to 20 people with different pocket PCs get connected to the ...

working with database Best practise?

I have a C# database layer that with static read method that is called every second in background timer. currently I create SqlCommand, SqlConnection once as a class memeber. In every method call I execute the command to get the results,I am doing so to avoid creation of connection and command every second, but I am afraid from except...

Does SQL Server 2005 Automatically Convert Time Fields to UTC? Does ADO.Net?

I'm using Visual Studio 2008. I'm using an .xsd/tableadapters to access a SQL Server 2005 database. One of my tables has a DateTime field. When a record is inserted into the table, the time is automatically converted to the UTC time, which is fine. I just want to know where that takes place. Does SQL Server do the conversion or is .Net d...

Is there a problem with ADO.NET DataSets in a load balanced environment?

For the last few months we've had a wierd problem with our website. Once in a while various queries to the database, using ADO.NET DataSets, will throw an error... the most common of which is "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." The data is actually val...

Sync Services Ado.net SyncSchema

hi I'm trying to build a custom ServerSyncProvider right now I'm trying to understand the GetScema Method I'm trying to build a dataSet and associate it to SyncSchema class one of my table columns is a nvarchar(50) so im doing this: DataColumn column = new DataColumn(); column.ColumnName = "Name"; column.DataType = ...

Does SqlDbType.DateTime not store seconds?

The environment I am using is C# 3.5, ado.net, sqlserver 2005. using System.Data; using System.Data.SqlClient; I am using a SqlCommand cmd.Parameters of SqlDbType.DateTime to create a record in the database. Seconds are not being stored in the database. The field in the db is of type datetime. Do I need to do something special to ...

foreign key constraint in sql

Hi everyone I have 2 tables in sql server with primary keys set to identity. They are related and work fine. I then created a form in vb 2008 and tried inserting some values into my database the respective primary keys work but the primary key in the parent table wont show up in the child table.I did create a relationship in vb using ad...

Third-Party Oracle Providers for .Net with object type support

I'm looking for a third-party Oracle Data Provider for .Net (ADO.NET) with a full support of Oracle object types (like geometries). I was foolish enough to use ODP.NET and now I'm paying the price - it's incredibly buggy and I just reached the end of the line (keep crashing IIS Pool - known issue, no resolution). I found dotConnect which...

TableAdapter query with an Int64 parameter over an ODBC data connection...

In this case, the Visual Studio designer generates a method which takes the parameter as an int, even though the corresponding database column is specified as System.Int64. This is the query specified in the "TableAdapter Query Configuration Wizard": SELECT * FROM my_table WHERE "status_id" = ? Again, status_id is of type System.In...

Batch multiple select statements when calling Oracle from ADO.NET

I want to batch multiple select statements to reduce round trips to the database. The code looks something like the pseudo code below. It works perfectly on SQL Server, but does not work on Oracle - Oracle complains about the sql syntax. I have had a look around and the only examples I can find of returning multiple result sets from Orac...

Is it possible for the data to be returned in different column order between execution when you run SELECT * FROM multiple table joins multiple times?

For example I have the following tables resulting from: CREATE TABLE A (Id int, BId int, Number int) CREATE TABLE B (Id int, Number decimal(10,2)) GO INSERT INTO A VALUES(1, 3, 10) INSERT INTO B VALUES(3, 50) INSERT INTO A VALUES(2, 5, 20) INSERT INTO B VALUES(5, 671.35) GO And I run the following query multiple times: SELECT * FROM ...

.NET SqlClient Error Number Enum Type

I have an exception handler for the type SqlException and I'm looking at the SqlException.Number property of the exception to determine if a dead-lock occurred (1205). I'm currious, instead of writing SqlException.Number == 1205, is there an enum I can refer to that would produce something similar to SqlException.Number == SqlExceptionNu...

How to retrieve data with LINQ to SQL into a weakly-typed object that can be moved around

In classic ASP we had the record set object. With ADO.Net we had the datatable. Both were simple .Net objects that could be moved around easily. What is the equivalent for using LINQ To SQL? Most examples show "var" being used, however, this seems completely non-oo as you can't move a var around (without a cast hack). My understandi...

First Item on Dropdownlist in blank

How to put the first item on the DropDownList in blank ? In VB is something like, DropDownList.index[0] = ""; I did this: string StrConn = ConfigurationManager.ConnectionStrings["connSql"].ConnectionString; SqlConnection conn = new SqlConnection(StrConn); conn.Open(); SqlDataReader dr; string sql; sql = @"Select N...

DbParameter IsNullable functionality?

I have not worked with parameters in ADO.Net very much. I'm writing a custom .Net data provider (modeled on SqlClient), and have to implement the IsNullable property in my parameter class, which inherits from DbParameter. My data provider will not support stored procedures, so I will only be supporting Input (substitution style) parame...