Tag: ado.net

add a connection to database not working, asp.net to mdf

i am adding a connection in asp.net using visual web developer to sql server database file, it’s an MDF file. when i click test connection i get this: alt text http://img534.imageshack.us/img534/5186/morric.jpg can someone please help me set up this connection

How to bind Image field to PictureBox in VB.Net 2008

I have a table with image field that I need to bind to System.Windows.Forms.PictureBox, and I need to Load new images o Overwrite existing images or delete the image int the field with ADO.NET dataset object.

SqlDataReader does not return all records

I am experiencing a problem with ADO.NET SqlDataReader. When I run underlying stored procedure directly in SSMS – it returns 1.7 million of records. When I run a related VB.NET code that fills an ADO.NET DataTable – I also get 1.7 million of records. But when I run a loop to fill a Generic list […]

Must declare the scalar variable “@ID” for insert parameter

I am receiving the error, Must declare the scalar variable “@ID”. Pointing at ExecuteScalar line. I looked on goggle and I think it has something to do with insert parameters for ID. Then again I read there could be a typo error. In my db I have declare column name as ID and Data Type […]

Read XML from SQL Server using OleDbDataReader

I’m stuck trying to read XML data from SQL Server using OleDb. private static void Main(string[] args){ var con = new OleDbConnection(“Provider=SQLNCLI11.1;Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Temp”); var cmd = new OleDbCommand( “SELECT [Id] ,[Description] FROM [Temp].[dbo].[SomeTable] where [Id]= 1 for xml path, root(‘root’)”, con); con.Open(); byte[] result = null; OleDbDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()){ result […]

c# adapter.fill dataset not working with stored procedure even though I know the parameters are returning data?

I have the strangest issue. The following works most of the time, however “now and again” it fails to return data, even though I have put a breakpoint for the adapter.fill statement, checked the params and executed them via SQL Management Studio which definitely returns the data 🙂 So this is a standard c# SQL […]

How to set XACT_ABORT within ADO.NET

How can I set XACT_ABORT to ON (or OFF) from within ADO.NET ?

How to resolve SqlConnection error “Keyword not supported: 'decr pool size'.”

I am creating Windows Application and using System.Data.SqlClient.SqlConnection object SqlConnection targetDatabaseConnection = new SqlConnection(ConnectionString); Following is the connection string Data Source=.;Initial Catalog=TestBCP_12;User ID=sa;Password=sa;Min Pool Size=100; Max Pool Size=100; Decr Pool Size=100; Incr Pool Size=100; Getting error with the following two settings Decr Pool Size=100; Incr Pool Size=100; I know all the sizes are 100 , […]

Sql Connection Error 40 Under Load

My database connections from my web servers work fine normally, but when a write heavy windows service I have triggers, I will randomly get “A network-related or instance-specific error occurred while establishing a connection to SQL Server. Error 40.” from my webservers. I have tried turning connection pooling off for my web servers since they […]

Query times out when run from ADO.NET but runs fine in Query Analyer

On local development machine my query times out indefinitely when run via website (ASP.NET – ADO.NET) Same query was running just yesterday fine. It runs fine when I execute it from local machine. I even resorted to rebooting machine. What can it be? Explanations per requests: Query times out after default 30 seconds (in ADO.NET). […]

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