ado.net

How to give ADO.NET Parameters

一个人想着一个人 提交于 2020-01-19 01:42:11
问题 I want to create a SQL command that adds record to DB. I tried the following code but it doesn't seem to be working: SqlCommand comand = new SqlCommand("INSERT INTO Product_table Values(@Product_Name,@Product_Price,@Product_Profit,@p)", connect); SqlParameter ppar = new SqlParameter(); ppar.ParameterName = "@Product_Name"; ppar.Value = textBox1.Text; MessageBox.Show("Done"); comaand.Parameters.Add(ppar); 回答1: In your case, it looks like you're using .NET. Using parameters is as easy as: C#

Visual Basic 2010 DataSet

与世无争的帅哥 提交于 2020-01-17 01:18:18
问题 I'm using Visual Studio 2010 and I'm working on a windows application form. I'm struggling with our database. I can connect and retrieve Data in the Grid View. But I don't want to display the records - I want to put a specific row column in a variable (in short I want to work with it). My DataSet is called ProductionDataSet . The Table is called Employee and has four columns called Employee , First_Name , Last_Name and Status . How do I now store lets say the entry in column 4 and row 5 in

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

感情迁移 提交于 2020-01-16 19:28:08
问题 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). If I set it to 0 (indefinite) - it runs indefinitely. In Query analyzer it runs immediately (1 second) Query didn't change. Here is code for view: . public static

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

跟風遠走 提交于 2020-01-16 19:27:51
问题 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). If I set it to 0 (indefinite) - it runs indefinitely. In Query analyzer it runs immediately (1 second) Query didn't change. Here is code for view: . public static

What is difference between Oracle session and Oracle Connection Or Both are the same..?

流过昼夜 提交于 2020-01-16 14:41:10
问题 I m using the Enterprise lib to connect Oracle Database class Customer{ private readonly Database _db; public Customer(){ _db = = DatabaseFactory.CreateDatabase(_userSettings.ConnstringName); } .. stuff to use this connection.. } When I run the application and opens multiple screen now Oracle show multiple session for same Application Also I tried by changing code as class Customer{ private readonly Database _db; public Customer(){ _db = = (_userSettings.GetInstance().GetDatabase); } .. stuff

C# ADO: Optimize query and its performance

我与影子孤独终老i 提交于 2020-01-16 12:03:26
问题 I have a C# RestApi which need to extract information of records from database using ADO by executing queries like this: declare @id1 int set @id1 = (select id from myTable where col1= x1, col2 = y1, col3 = z1 from mappingTable) declare @id2 int set @id2 = (select id from myTable where col1= x2, col2 = y2, col3 = z2 from mappingTable) declare @id3 int set @id3 = (select id from myTable where col1= x3, col2 = y3, col3 = z3 from mappingTable) . . . declare @idN int set @idN = (select id from

How do I extract “eTag” or “x-ms-request-id” from my Astoria DataContext response?

一世执手 提交于 2020-01-16 11:09:25
问题 The Azure table whitepaper mentions that the x-ms-request-id is useful to send to Microsoft in the event there is an error working with the data. If I do have such an error, I'd like my try...catch block to take this and save it somewhere for future analysis. In addition I need to extract the ETag value as well while in Table storage. How do I extract this information and have it available when the Exception comes around? HTTP/1.1 204 No Content Content-Length: 0 ETag: W/"datetime'2008-10

How to query Excel data which is in memory using OLEDB?

江枫思渺然 提交于 2020-01-16 05:31:29
问题 I have a file upload control on a web page. Users will upload the excel files and in my code, first I save the excel file to the disk and then open it with OLEDB connection and do my stuff. My question is: Is there anyway to avoid saving this file to disk? 回答1: No. The file exists probably as a text stream data reader somewhere in the file upload control. To get at it, you would have to hack the control or the HttpHandler that is processing the upload, which would not be fun. Saving it to a

Passing OracleLob as parameter to a function

不羁岁月 提交于 2020-01-15 11:42:49
问题 I want to accomplish a similar thing: try { openConnection(); OracleCommand cmd = new OracleCommand("SELECT CUSTOMER_ID, IMAGE_BLOB FROM CUSTOMER_IMAGE WHERE CUSTOMER_ID IN (3026)", conn); string pubID = ""; OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess); //create the report object MemoryStream memStream; DataSet ds = new DataSet(); DataTable ImageTable = new DataTable(); BinaryReader binReader; DataRow dr; byte[] byteArrName; OracleLob blob; while (reader.Read(

Passing OracleLob as parameter to a function

喜夏-厌秋 提交于 2020-01-15 11:42:47
问题 I want to accomplish a similar thing: try { openConnection(); OracleCommand cmd = new OracleCommand("SELECT CUSTOMER_ID, IMAGE_BLOB FROM CUSTOMER_IMAGE WHERE CUSTOMER_ID IN (3026)", conn); string pubID = ""; OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess); //create the report object MemoryStream memStream; DataSet ds = new DataSet(); DataTable ImageTable = new DataTable(); BinaryReader binReader; DataRow dr; byte[] byteArrName; OracleLob blob; while (reader.Read(