Tag: ado.net

insert data to db in loop performance

I’m trying to write Windows app to get data from From Fox Pro DB, and inset it to Sql Server 2008 db. I wrote code, but it works very slow. rowsCount more than 1 million My code below: OleDbConnection cn = new OleDbConnection(foxProConnectionString); SqlConnection cSql = new SqlConnection(sqlServerConnectionString); cSql.Open(); OleDbCommand ocmd = new OleDbCommand(“Select * […]

How can I check if the connected SQL Server is on the local machine?

Is there any way of telling, using C#, if the Sql Server I’m connected to in Ado.Net is on the local machine rather than remote? I’m wanting to know whether I have access to the file system where SQL Server stores, for example it’s backup files. That would let me determine whether I would be […]

Creating SQL users and restricting their permissions

Greetings, My program creates a SQL database using ADO.NET APIs to connect to a SQL server and manipulate SQL connections/transactions. When the database is created, I’m connecting to the server using ‘sa’ credentials. This will be the only time I will connect to the database using ‘sa’ credentials. During this same initial connection, I need […]

SqlClient.SqlException .Number = 3617 .State = 68

We are receiving this exception from one of our sql select statements. I cannot find error 3617 in the sysmessages table. The .Class is 25. There is no message. We know we are getting it on Sql server 2005 servers. I do know that this is large select that joins several tables and uses the […]

Fill DropDownList from database

I am new to C# and trying to populate a DropDownList based on a database value. I tried connecting to database as shown below – tested with the statement and it says connected. Can I assume this is correct? Am I on the right track? Also, how do I then select value from the table […]

extending query timeout settings

I have a WPF application that directly communicates with a MS SQL 2008 database. In the connection string, I have explicitly set the connection time out to be “Connect Timeout=6000”, which should give me ten minutes. I see that my application gives me a timeout error in just a little more than a minute. How […]

Execute multiple stored procedures with single trip to database

I have a lot of legacy data access code mainly SqlCommand with Stored Procedure calls that we used to execute alot of Insert statment into an database. As long as the SQL server has been on the same machine as the application there have been acceptable performace but now are we trying to move some […]

A transport-level error has occurred when receiving results from the server. – What's the SqlException ErrorCode and Number?

We’re getting these errors in an environment where I’d rather not drop code just to determine the SqlException’s Number and ErrorCode. I’m trying to put in special exception handling for this error and don’t want to do string parsing. Does anyone know what error number this is or have a link to an extensive list […]

Trying to Insert Values into a Database from TextBoxes

I am totally stumped on this one, and I’m brand new to C# so maybe one of you fine folks can help me out. I’m trying to update a database from form fields using ADO.NET. Basically, the error I’m getting is that I am trying to insert null values into the database. The exact text […]

Web-Service: How to authenticate users with the SQL Server database table using VB

Can somebody tell me how to authenticate users with the SQL Server database table using VB as a web service. I managed to connect to the SQL server via this VB code; Public Sub ConnectToSQL() Dim con As New SqlConnection Dim cmd As New SqlCommand Try con.ConnectionString = “Data Source=(local);Initial Catalog=TestDatabase;Persist Security Info=True;User ID=sa;Password=421” con.Open() […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.