ADO.NET Data Providers ForumData platform development using classic ADO.NET (v 1.1 and 2.0) and System.Data namespace. For SQL Native Client or related topics, see SQL Server Data Access forum© 2009 Microsoft Corporation. All rights reserved.Thu, 26 Nov 2009 00:41:37 Z0145d595-6d1f-4e9a-959d-5b947b82600fhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/1ebef776-5e91-4153-831b-df01c11b814chttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/1ebef776-5e91-4153-831b-df01c11b814cNoorul Ahmedhttp://social.msdn.microsoft.com/Profile/en-US/?user=Noorul%20AhmedOledbTransaction blocking insert in OracleDear All,<br/>           I have a order processing module written in .NET . In it, I open an OledbTransaction to the Oracle 10g database and keep the transaction open until all items are added and processed and then once order is complete, I commit the transaction. Eg:<br/> <pre lang=x-vbnet> dim saConn as oledbconnection = New OleDb.OleDbConnection(&quot;Provider=MSDAORA.1;Data Source=test;User Id=test;Password=test&quot;) Try saConn.Open() saTrans = saConn.BeginTransaction(IsolationLevel.Unspecified) Catch ex As Exception MsgBox(&quot;Error: &quot; &amp; ex.Message, MsgBoxStyle.Critical) Me.Close() Exit Sub End Try ....</pre> Then I do the insert for the first time in the table. For eg:<br/><br/> <pre> dim sql as string = &quot;insert into orders &quot; &amp; _ &quot;(sn, item_code, creation_date,customer_name) &quot; &amp; _ &quot; values &quot; &amp; _ &quot; (95, 'X1342', to_date('21/11/2009','dd/mm/yyyy'), 'Mr. A.N.Y. Body') &quot; res = ExecuteDMLWithTransaction(sql, saConn, saTrans)</pre> Now, if I start another instance of the application, repeat the steps then I am unable to do the SQL insert from the other instance until I either commit or rollback Transaction from the first one. Please help me to resolve this problem as the transaction seems to lock the whole table. <br/><br/>Thanks,<br/>Noorul<br/><br/>Sat, 21 Nov 2009 06:14:44 Z2009-11-26T00:41:37Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/75a166e3-90e4-4f22-ab1e-a8c9b334793dhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/75a166e3-90e4-4f22-ab1e-a8c9b334793ddef2http://social.msdn.microsoft.com/Profile/en-US/?user=def2Bug ? in .NET 3.5 SP1<p>Hi,<br/>I think I've found a bug in ADO.NET using .NET Framework 3.5.  My system is WinXP x64, and I'm running SQL Server 2008 Std.  The bug presents itself as a dropped connection from my web application (that uses connection pooling).  I can cause the problem to happen by performing an update using a DataAdapter with a DataSet that has one row changed (only one table in the DataSet).  The table in my database has several columns, some of which are of type 'datetime'.  When I change the value in the dataset's table's row to DateTime.MinValue and then call adapter.Update(dataset), the connection to SQL Server closes.  There is a corresponding pair of errors logged in SQL Server: <br/>--------------------------------<br/>Date  12/11/2009 2:26:37 PM<br/>Log  SQL Server (Current - 12/11/2009 4:59:00 PM)<br/>Source  spid51<br/>Message<br/>The client was unable to reuse a session with SPID 51, which had been reset for connection pooling. The failure ID is 29. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.<br/>------------------<br/>and:<br/>------------------<br/>Date  12/11/2009 2:26:37 PM<br/>Log  SQL Server (Current - 12/11/2009 4:59:00 PM)<br/>Source  spid51<br/>Message<br/>Error: 18056, Severity: 20, State: 29.<br/>------------------<br/><br/>When I use an alternate method for performing the same update ( opening a new connection, setting the command text as an SQL statement with parameters, adding parameters and setting their values, then calling command.ExecuteNonQuery(), I get a real error message that states the datetime value is out of range.<br/><br/>When using the DataAdapter (the first example above), shouldn't the call just return an error instead of generating SQL Server errors that cause the connection to be dropped?<br/><br/>Thanks</p>Thu, 12 Nov 2009 22:06:58 Z2009-11-26T00:37:44Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/6ae0bf09-2845-45cc-b717-6a6d0be1fba6http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/6ae0bf09-2845-45cc-b717-6a6d0be1fba6Well0549http://social.msdn.microsoft.com/Profile/en-US/?user=Well0549Strange connection behaviour. (memory leak)(need help)<div><span style="font-size:x-small;color:#000000;font-family:Arial">I have written a polling component that connects to a sybase database every 5 seconds and then executes a stored procedure.</span></div> <div><span style="font-size:x-small;font-family:Arial">This polling component is a BizTalk Adapter but that doesn't matter for the problem that I encounter.</span></div> <div> </div> <div><span style="font-size:x-small;font-family:Arial">To connect to the Sybase Database I use two DLL's that come with sybase, they are :</span></div> <ul> <li><span style="font-size:x-small;font-family:Arial">Sybase.Data.AseClient.dll</span> </li> <li><span style="font-size:x-small;font-family:Arial">sybdrvado115.dll</span></li> </ul> <div><span style="font-size:x-small;font-family:Arial"><strong>The problem.</strong></span></div> <div> </div> <div><span style="font-size:x-small;font-family:Arial">De polling component works fine and there are absolutely no signs of a memory leak. After running for several days memroy consumtion is still low.</span></div> <div><span style="font-size:x-small;font-family:Arial">Then all of a sudden there is something wrong with the Unix Server and it is no longer possible to create a connection to the Sybase Server hosted on the Unix machine.</span></div> <div> </div> <div><span style="font-size:x-small;font-family:Arial">The error I get is the following :</span></div> <div> </div> <blockquote style="margin-right:0px" dir=ltr> <blockquote style="margin-right:0px" dir=ltr> <div><span style="font-size:x-small;font-family:Arial"><em>Event Type: Warning<br/>Event Source: BizTalk Server 2006<br/>Event Category: BizTalk Server 2006 <br/>Event ID: 5740<br/>Date:  3-11-2009<br/>Time:  14:45:35<br/>User:  N/A<br/>Computer: <br/>Description:XXXXXXXX<br/>The adapter &quot;SybaseStoredProcedure&quot; raised an error message. Details &quot;Client unable to establish a connection&quot;.</em></span></div> <div><span style="font-size:x-small;font-family:Arial"><em>For more information, see Help and Support Center at </em></span><a href="http://social.msdn.microsoft.com/exchweb/bin/redir.asp?URL=http://go.microsoft.com/fwlink/events.asp"><span style="font-size:x-small;font-family:Arial"><em>http://go.microsoft.com/fwlink/events.asp</em></span></a><span style="font-size:x-small;font-family:Arial"><em>.</em></span></div> </blockquote> </blockquote> <div> </div> <div><span style="font-size:x-small;font-family:Arial">From that moment on there is a memory leak on each poll. So I went to my Development server and tried to enter an invalid Machine name to get the same error message.</span></div> <div> </div> <blockquote style="margin-right:0px" dir=ltr> <blockquote style="margin-right:0px" dir=ltr> <div><span style="font-size:x-small;font-family:Arial">Event Type: Warning<br/>Event Source: BizTalk Server 2006<br/>Event Category: BizTalk Server 2006 <br/>Event ID: 5740<br/>Date:  11/5/2009<br/>Time:  9:13:32 AM<br/>User:  N/A<br/>Computer: YYYYYYYY<br/>Description:<br/>The adapter &quot;SybaseStoredProcedure&quot; raised an error message. Details &quot;Client unable to establish a connection&quot;.</span></div> <div><span style="font-size:x-small;font-family:Arial">For more information, see Help and Support Center at <a href="http://social.msdn.microsoft.com/exchweb/bin/redir.asp?URL=http://go.microsoft.com/fwlink/events.asp">http://go.microsoft.com/fwlink/events.asp</a>.</span></div> </blockquote> </blockquote> <p><span style="font-size:x-small;font-family:Arial">So I have exactly the same error message on my developement machine but this time there is NO memory leak at all. <div>So the real question is....</div> <div> </div> <div>Does anybody have a clou why a memory leak can exist in this situation.</div> <div> </div> <div>I have been thinking about several options</div> <div>- The sybase components do some caching and once a connection has been made, it will return that same connection every time.</div> <div>  ( if the connection is broken later on the sybase components don't pick it up ? )</div> <div>- The polling component is unable to connect to the Sybase adapter unless it's host process (host process of polling component = BizTalk) is restarted.....</div> <div> </div> <div>The code that gets executed on every poll is the following :</div> <div> </div> <div> <pre class=code0> <span class=code1>public </span><span class=code2>void </span><span class=code3>SubmitBatch</span><span class=code4>()</span> <span class=code4>{</span> <span class=code5>int </span><span class=code6>nrOfMessages </span><span class=code4>= </span><span class=code7>0</span><span class=code4>;</span> <span class=code8>try</span> <span class=code4>{</span> <span class=code9>this</span><span class=code4>.</span><span class=code6>receivingData </span><span class=code4>= </span><span class=code10>true</span><span class=code4>;</span> <span class=code11>// used to block the Terminate from BizTalk </span> <span class=code1>if </span><span class=code4>(!</span><span class=code9>this</span><span class=code4>.</span><span class=code6>control</span><span class=code4>.</span><span class=code3>Enter</span><span class=code4>())</span> <span class=code4>{</span> <span class=code12>return</span><span class=code4>;</span> <span class=code4>}</span> <span class=code6>SyncReceiveSubmitBatch batch </span><span class=code4>= </span><span class=code9>null</span><span class=code4>;</span> <span class=code1>while </span><span class=code4>(</span><span class=code6>nrOfMessages </span><span class=code4>&lt; </span><span class=code6>properties</span><span class=code4>.</span><span class=code6>ReceiveBatchSize </span><span class=code4>&amp;&amp; !</span><span class=code6>control</span><span class=code4>.</span><span class=code6>TerminateCalled</span><span class=code4>)</span> <span class=code4>{</span> <span class=code6>MemoryStream newMsgStream </span><span class=code4>= </span><span class=code9>null</span><span class=code4>;</span> <span class=code11>// Now try to recieve data </span> <span class=code13>using </span><span class=code4>(</span><span class=code6>AseConnection conn </span><span class=code4>= </span><span class=code6>currentHelper</span><span class=code4>.</span><span class=code3>BuildConnection</span><span class=code4>(</span><span class=code6>connectionParameters</span><span class=code4>))</span> <span class=code4>{</span> <strong><span class=code6>conn</span><span class=code4>.</span><span class=code3>Open</span><span class=code4>();</span></strong> <span class=code1>if </span><span class=code4>(</span><span class=code6>connectionParameters</span><span class=code4>.</span><span class=code6>TransactionLevel </span><span class=code4>!= </span><span class=code6>System</span><span class=code4>.</span><span class=code6>Data</span><span class=code4>.</span><span class=code6>IsolationLevel</span><span class=code4>.</span><span class=code6>Unspecified</span><span class=code4>)</span> <span class=code4>{</span> <span class=code6>AseTransaction trans </span><span class=code4>= </span><span class=code6>conn</span><span class=code4>.</span><span class=code3>BeginTransaction</span><span class=code4>(</span><span class=code6>connectionParameters</span><span class=code4>.</span><span class=code6>TransactionLevel</span><span class=code4>);</span> <span class=code4>}</span> <span class=code13>using </span><span class=code4>(</span><span class=code6>AseCommand cmd </span><span class=code4>= </span><span class=code6>currentHelper</span><span class=code4>.</span><span class=code3>BuildCommandObject</span><span class=code4>(</span><span class=code6>connectionParameters</span><span class=code4>, </span><span class=code6>conn</span><span class=code4>))</span> <span class=code4>{</span> <span class=code13>using </span><span class=code4>(</span><span class=code6>DataTable resultParameters </span><span class=code4>= </span><span class=code6>currentHelper</span><span class=code4>.</span><span class=code3>GenerateParameterDatatable</span><span class=code4>(</span><span class=code6>connectionParameters</span><span class=code4>))</span> <span class=code4>{</span> <span class=code6>DataSet ds </span><span class=code4>= </span><span class=code10>new </span><span class=code3>DataSet</span><span class=code4>(</span><span class=code14>&quot;PRC_&quot; </span><span class=code4>+ </span><span class=code6>connectionParameters</span><span class=code4>.</span><span class=code6>ProcedureName</span><span class=code4>);</span> <span class=code6>AseDataAdapter da </span><span class=code4>= </span><span class=code10>new </span><span class=code3>AseDataAdapter</span><span class=code4>(</span><span class=code6>cmd</span><span class=code4>);</span> <span class=code6>da</span><span class=code4>.</span><span class=code3>Fill</span><span class=code4>(</span><span class=code6>ds</span><span class=code4>, </span><span class=code14>&quot;PRC_ROWS_&quot; </span><span class=code4>+ </span><span class=code6>connectionParameters</span><span class=code4>.</span><span class=code6>ProcedureName</span><span class=code4>);</span> <span class=code6>currentHelper</span><span class=code4>.</span><span class=code3>ResultParametersToTable</span><span class=code4>(</span><span class=code6>ds</span><span class=code4>, </span><span class=code6>resultParameters</span><span class=code4>, </span><span class=code6>cmd</span><span class=code4>);</span> <span class=code1>if </span><span class=code4>(</span><span class=code6>ds</span><span class=code4>.</span><span class=code6>Tables</span><span class=code4>[</span><span class=code14>&quot;PRC_ROWS_&quot; </span><span class=code4>+ </span><span class=code6>connectionParameters</span><span class=code4>.</span><span class=code6>ProcedureName</span><span class=code4>].</span><span class=code6>Rows</span><span class=code4>.</span><span class=code6>Count </span><span class=code4>&gt; </span><span class=code7>0</span><span class=code4>)</span> <span class=code4>{</span> <span class=code11>// Data was found write the data to the stream...</span> <span class=code6>newMsgStream </span><span class=code4>= </span><span class=code10>new </span><span class=code3>MemoryStream</span><span class=code4>();</span> <span class=code6>ds</span><span class=code4>.</span><span class=code3>WriteXml</span><span class=code4>(</span><span class=code6>newMsgStream</span><span class=code4>);</span> <span class=code6>newMsgStream</span><span class=code4>.</span><span class=code6>Position </span><span class=code4>= </span><span class=code7>0</span><span class=code4>;</span> <span class=code4>}</span> <span class=code1>if </span><span class=code4>(</span><span class=code6>connectionParameters</span><span class=code4>.</span><span class=code6>TransactionLevel </span><span class=code4>!= </span><span class=code6>System</span><span class=code4>.</span><span class=code6>Data</span><span class=code4>.</span><span class=code6>IsolationLevel</span><span class=code4>.</span><span class=code6>Unspecified</span><span class=code4>)</span> <span class=code4>{</span> <span class=code6>conn</span><span class=code4>.</span><span class=code6>Transaction</span><span class=code4>.</span><span class=code3>Commit</span><span class=code4>();</span> <span class=code4>}</span> <span class=code6>da</span><span class=code4>.</span><span class=code3>Dispose</span><span class=code4>();</span> <span class=code6>ds</span><span class=code4>.</span><span class=code3>Dispose</span><span class=code4>();</span> <span class=code4>}</span> <span class=code4>}</span> <span class=code1>if </span><span class=code4>(</span><span class=code6>conn</span><span class=code4>.</span><span class=code6>State </span><span class=code4>!= </span><span class=code6>ConnectionState</span><span class=code4>.</span><span class=code6>Closed</span><span class=code4>)</span> <span class=code4>{</span> <span class=code6>conn</span><span class=code4>.</span><span class=code3>Close</span><span class=code4>();</span> <span class=code4>}</span> <span class=code4>}</span> <span class=code1>if </span><span class=code4>(</span><span class=code6>newMsgStream </span><span class=code4>== </span><span class=code9>null</span><span class=code4>)</span> <span class=code4>{</span> <span class=code12>break</span><span class=code4>; </span><span class=code11>// We might not have reached the batchsize yet but we don't want to wait for that.</span> <span class=code4>}</span> <span class=code1>else</span> <span class=code4>{</span> <span class=code6>newMsgStream</span><span class=code4>.</span><span class=code3>Flush</span><span class=code4>();</span> <span class=code6>newMsgStream</span><span class=code4>.</span><span class=code3>Seek</span><span class=code4>(</span><span class=code7>0</span><span class=code4>, </span><span class=code6>SeekOrigin</span><span class=code4>.</span><span class=code6>Begin</span><span class=code4>);</span> <span class=code6>IBaseMessage btsMsg </span><span class=code4>= </span><span class=code3>CreateMessage</span><span class=code4>(</span><span class=code6>newMsgStream</span><span class=code4>);</span> <span class=code1>if </span><span class=code4>(</span><span class=code6>batch </span><span class=code4>== </span><span class=code9>null</span><span class=code4>)</span> <span class=code4>{</span> <span class=code11>//Create a new batch when this is the first message</span> <span class=code6>batch </span><span class=code4>= </span><span class=code10>new </span><span class=code3>SyncReceiveSubmitBatch</span><span class=code4>(</span><span class=code9>this</span><span class=code4>.</span><span class=code6>transportProxy</span><span class=code4>, </span><span class=code9>this</span><span class=code4>.</span><span class=code6>control</span><span class=code4>, </span><span class=code7>1</span><span class=code4>);</span> <span class=code4>}</span> <span class=code1>if </span><span class=code4>(</span><span class=code6>properties</span><span class=code4>.</span><span class=code6>IsTwoWay</span><span class=code4>)</span> <span class=code4>{</span> <span class=code11>// Put your reponse handler code here, if needed.</span> <span class=code4>}</span> <span class=code1>else</span> <span class=code4>{</span> <span class=code11>// batch.SubmitMessage(btsMsg, new StreamAndUserData(btsMsg.BodyPart.Data, newMsgStream));</span> <span class=code6>batch</span><span class=code4>.</span><span class=code3>SubmitMessage</span><span class=code4>(</span><span class=code6>btsMsg</span><span class=code4>);</span> <span class=code4>}</span> <span class=code6>nrOfMessages</span><span class=code4>++;</span> <span class=code4>}</span> <span class=code4>}</span><span class=code11>//end while</span> <span class=code1>if </span><span class=code4>(</span><span class=code6>nrOfMessages </span><span class=code4>!= </span><span class=code7>0</span><span class=code4>)</span> <span class=code4>{</span> <span class=code6>batch</span><span class=code4>.</span><span class=code3>Done</span><span class=code4>();</span> <span class=code4>}</span> <span class=code4>}</span> <span class=code8>catch </span><span class=code4>(</span><span class=code6>Exception e</span><span class=code4>)</span> <span class=code4>{</span> <span class=code9>this</span><span class=code4>.</span><span class=code6>transportProxy</span><span class=code4>.</span><span class=code3>SetErrorInfo</span><span class=code4>(</span><span class=code6>e</span><span class=code4>);</span> <span class=code4>}</span> <span class=code8>finally</span> <span class=code4>{</span> <span class=code9>this</span><span class=code4>.</span><span class=code6>control</span><span class=code4>.</span><span class=code3>Leave</span><span class=code4>();</span> <span class=code4>}</span> <span class=code6>receivingData </span><span class=code4>= </span><span class=code10>false</span><span class=code4>;</span> <span class=code4>}</span> </pre> </div> <div><br/> </div> </span></p><hr class="sig">Well0549Thu, 05 Nov 2009 08:56:18 Z2009-11-26T00:35:32Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/3246e516-2637-421e-9b97-0dc5fea88df9http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/3246e516-2637-421e-9b97-0dc5fea88df9Well0549http://social.msdn.microsoft.com/Profile/en-US/?user=Well0549Memory leak on connection due to faulty host file<p>I have a memory leak problem with a connection.<br/>I use the Sybase ado providers but maybe someone experienced this problem as well.<br/><br/>If I enter a faulty server name in the connection string i get an exception like 'Client unable to establish a connection'<br/><br/>If i enter a correct server name but mes sup my host file Pointing to 1.1.1.1 as the ip adress of my server I get a memory leak.<br/><br/>Anybody got any experience with this ?</p><hr class="sig">Well0549Thu, 12 Nov 2009 08:18:37 Z2009-11-26T00:34:50Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/0b7fcec7-10db-4c9e-872e-f03ed745e2a9http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/0b7fcec7-10db-4c9e-872e-f03ed745e2a9Amudhuhttp://social.msdn.microsoft.com/Profile/en-US/?user=AmudhuHow export dataset/datatable to MDB Hi Pro's,<br><br>kindly help me with the issue: Export dataset/datatable to MDB using C#Tue, 16 Dec 2008 07:54:01 Z2009-11-25T22:20:03Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/19ac0cf4-55db-4c3a-87e6-ffb3403c22bbhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/19ac0cf4-55db-4c3a-87e6-ffb3403c22bbmxcolinhttp://social.msdn.microsoft.com/Profile/en-US/?user=mxcolinUsing Paramters with Jet Oledb<p>I am having problems using DateTime parameters in the Jet Oledb I have the following code<br/><br/>I would expect the first row to throw the exception but it doesn't. Surely I should get a date back and not a string???</p> <p>Any help would be greatly appreciated.</p> <p>Colin<br/><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small"><span style="font-size:small"><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small"><br/>OleDbConnection</span></span><span style="color:#000000;font-size:small"> connection = </span><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small">new</span></span><span style="color:#000000;font-size:small"> </span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">OleDbConnection</span></span><span style="color:#000000;font-size:small">(</span><span style="color:#a31515;font-size:small"><span style="color:#a31515;font-size:small">&quot;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Test.accdb;Persist Security Info=True&quot;</span></span><span style="font-size:small"><span style="color:#000000">);</span><font size=3> <p> </p> </font></span></span></span></span></span></span></p> <p><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">OleDbCommand</span></span><span style="font-size:small"> command = </span><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small">new</span></span><span style="font-size:small"> </span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">OleDbCommand</span></span><span style="font-size:small">(</span><span style="color:#a31515;font-size:small"><span style="color:#a31515;font-size:small">&quot;SELECT ID, @DateParam FROM Test&quot;</span></span><span style="font-size:small">, connection);<br/></span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">OleDbParameter</span></span><span style="font-size:small"> param = </span><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small">new</span></span><span style="font-size:small"> </span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">OleDbParameter</span></span><span style="font-size:small">(</span><span style="color:#a31515;font-size:small"><span style="color:#a31515;font-size:small">&quot;@DateParam&quot;</span></span><span style="font-size:small">, </span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">OleDbType</span></span><span style="font-size:small">.DBTimeStamp);<font size=3> <p>param.Value =</p> </font></span></p> <p><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">DateTime</span></span><span style="font-size:small">.Now;<font size=3> <p> </p> </font></span></p> <p><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">OleDbDataAdapter</span></span><span style="font-size:small"> adapter = </span><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small">new</span></span><span style="font-size:small"> </span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">OleDbDataAdapter</span></span><span style="font-size:small">(command);<br/></span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">DataTable</span></span><span style="font-size:small"> table = </span><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small">new</span></span><span style="font-size:small"> </span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">DataTable</span></span><span style="font-size:small">();  <p>command.Parameters.Add(param);<br/>adapter.Fill(table);</p> <font size=3> <p> </p> </font></span></p> <p><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">Console</span></span><span style="font-size:small">.WriteLine(table.Rows[0].Field&lt;</span><span style="color:#0000ff;font-size:small"><span style="color:#0000ff;font-size:small">string</span></span><span style="font-size:small">&gt;(1)); </span><span style="color:#008000;font-size:small"><span style="color:#008000;font-size:small">// THIS LINE IS FINE<br/></span></span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">Console</span></span><span style="font-size:small">.WriteLine(table.Rows[0].Field&lt;</span><span style="color:#2b91af;font-size:small"><span style="color:#2b91af;font-size:small">DateTime</span></span><span style="font-size:small">&gt;(1)); </span><span style="color:#008000;font-size:small"><span style="color:#008000;font-size:small">// THROWS InvalidCastException</span></span></p>Tue, 17 Nov 2009 22:37:59 Z2009-11-25T20:59:22Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/9c5bb27c-2963-4b3c-aeaa-3aa7b18886f1http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/9c5bb27c-2963-4b3c-aeaa-3aa7b18886f1dabdhttp://social.msdn.microsoft.com/Profile/en-US/?user=dabdProblem reading XML Schema?Hi, <br><br>I have the XSD below and the corresponding XML. If I try to read it usind ReadXml with XmlReadMode.ReadSchema it returns no data.  However with XmlReadMode.InferSchema it works.<br><br>What is missing here?<br><br>Thanks<br><br><br>-------------<br>CODE<br><br>DataSet ds = new DataSet();<br>            ds.ReadXml(@&quot;C:\Documents and Settings\db2admin\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\XMLFile1.xml&quot;,<br>          XmlReadMode.ReadSchema);<br><br>XSD<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;xs:schema id=&quot;XMLSchema1&quot; targetNamespace=&quot;http://tempuri.org/XMLSchema1.xsd&quot; elementFormDefault=&quot;qualified&quot; xmlns=&quot;http://tempuri.org/XMLSchema1.xsd&quot; xmlns:mstns=&quot;http://tempuri.org/XMLSchema1.xsd&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;<br>  &lt;xs:element name=&quot;Projects&quot;&gt;<br>    &lt;xs:complexType&gt;<br>      &lt;xs:sequence&gt;<br>        &lt;xs:element name=&quot;Project&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;<br>          &lt;xs:complexType&gt;<br>            &lt;xs:sequence&gt;<br>              &lt;xs:element name=&quot;id_project&quot; type=&quot;xs:short&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot; /&gt;<br>            &lt;/xs:sequence&gt;<br>          &lt;/xs:complexType&gt;<br>        &lt;/xs:element&gt;<br>      &lt;/xs:sequence&gt;<br>    &lt;/xs:complexType&gt;<br>  &lt;/xs:element&gt;<br>&lt;/xs:schema&gt;<br><br><br>XML<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;<br>&lt;Projects xmlns=&quot;http://tempuri.org/XMLSchema1.xsd&quot;&gt;<br>  &lt;Project&gt;<br>    &lt;id_project&gt; 1 &lt;/id_project&gt;<br>&lt;/Project&gt;<br>  &lt;Project&gt;<br>    &lt;id_project&gt; 2 &lt;/id_project&gt;<br>&lt;/Project&gt;<br>&lt;/Projects&gt;<br><br><br><br>Mon, 12 Feb 2007 12:25:10 Z2009-11-25T20:58:35Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/766aabc1-6113-46da-9c5c-7f62a87a5f23http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/766aabc1-6113-46da-9c5c-7f62a87a5f23Jiri {x2} Cincurahttp://social.msdn.microsoft.com/Profile/en-US/?user=Jiri%20%7bx2%7d%20CincuraIntelliTrace support in 3rd party providersHi *,<br/><br/>I really like the new IntelliTrace support in i.e. SqlClient, you can see when and what command was executed pretty easily. And I would like to also add support for this into <a href="http://firebirdsql.org/index.php?op=files&amp;id=netprovider">provider for Firebird</a>. Is there some description what a provider writer needs to implement (and call), to make this work?<hr class="sig">Jiri {x2} CincuraWed, 25 Nov 2009 09:31:49 Z2009-11-25T09:31:50Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/86e72cff-8c35-4994-8774-03535c06a744http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/86e72cff-8c35-4994-8774-03535c06a744Antoopshttp://social.msdn.microsoft.com/Profile/en-US/?user=AntoopsORA-01453: SET TRANSACTION must be first statement of transaction<p align=left><font face=Arial size=2></font> </p> <p>Hi All,</p> <p align=left> </p> <p align=left>I am getting an error <strong>ORA-01453:  SET TRANSACTION must be first statement of transaction. <font color="#ff0000">rarely</font></strong></p> <p align=left>My code is :</p><font color="#0000ff" size=2> <p>Try</p></font><font size=2> <p></font><font color="#008000" size=2>' get a connection object with the connection string set</p></font><font size=2> <p>conn = Configurations.get_DB_Connection_Write(txtKey)</p> <p></font><font color="#008000" size=2>' open the connection</p></font><font size=2> <p>conn.Open()</p> <p></font><font color="#008000" size=2>' begin transaction</p></font><font size=2> <p>ts = conn.BeginTransaction(IsolationLevel.ReadCommitted)</p> <p></font><font color="#008000" size=2>' create a command object</p></font><font size=2> <p>cmd = </font><font color="#0000ff" size=2>New</font><font size=2> OracleCommand(SQLText, conn, ts)</p> <p></font><font color="#008000" size=2>' Add the parameter objects to the command</p></font><font size=2> <p></font><font color="#0000ff" size=2>If</font><font size=2> (</font><font color="#0000ff" size=2>Not</font><font size=2> params </font><font color="#0000ff" size=2>Is</font><font size=2> </font><font color="#0000ff" size=2>Nothing</font><font size=2>) </font><font color="#0000ff" size=2>Then</p></font><font size=2> <p></font><font color="#0000ff" size=2>For</font><font size=2> i = 0 </font><font color="#0000ff" size=2>To</font><font size=2> UBound(params)</p> <p>cmd.Parameters.Add(params(i))</p> <p></font><font color="#0000ff" size=2>Next</font><font size=2> (i)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>If</p></font><font size=2> <p></font><font color="#008000" size=2>' Execute the command and return the nbr of rows affected</p></font><font size=2> <p>NbrRowsAffected = cmd.ExecuteNonQuery()</p> <p></font><font color="#008000" size=2>' commit transaction</p></font><font size=2> <p>ts.Commit()</p> <p></font><font color="#008000" size=2>' return the nbr of rows affected</p></font><font size=2> <p></font><font color="#0000ff" size=2>Return</font><font size=2> NbrRowsAffected</p> <p></font><font color="#0000ff" size=2>Catch</font><font size=2> ex </font><font color="#0000ff" size=2>As</font><font size=2> Exception</p> <p></font><font color="#008000" size=2>' Rollback the transaction</p></font><font size=2> <p></font><font color="#0000ff" size=2>If</font><font size=2> (</font><font color="#0000ff" size=2>Not</font><font size=2> ts </font><font color="#0000ff" size=2>Is</font><font size=2> </font><font color="#0000ff" size=2>Nothing</font><font size=2>) </font><font color="#0000ff" size=2>Then</font><font size=2> ts.Rollback()</p> <p></font><font color="#008000" size=2>' throw all exceptions</p></font><font size=2> <p></font><font color="#008000" size=2>' throwing exception with class name, method name and exception message</p></font><font size=2> <p></font><font color="#0000ff" size=2>Throw</font><font size=2> ex</font></p> <p align=left><font size=2></font><font color="#0000ff" size=2>Finally</p></font><font size=2> <p></font><font color="#008000" size=2>' close the connection</p></font><font size=2> <p></font><font color="#0000ff" size=2>If</font><font size=2> (</font><font color="#0000ff" size=2>Not</font><font size=2> conn </font><font color="#0000ff" size=2>Is</font><font size=2> </font><font color="#0000ff" size=2>Nothing</font><font size=2>) </font><font color="#0000ff" size=2>Then</font><font size=2> conn.Close()</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>Try</font></p> <p align=left><font color="#0000ff" size=2></font> </p> <p align=left><font color="#0000ff">I dont why is this getting .....and also  this error is not consistent...... my db is oracle 9i...</font></p> <p align=left><font color="#0000ff">advd thanks for your help</font></p> <p align=left><font color="#0000ff"></font> </p> <p align=left><font color="#0000ff">thanks</font></p> <p align=left><font color="#0000ff">Antoops</font></p> <p align=left><font color="#0000ff" size=2> </p></font>Thu, 13 Sep 2007 07:10:50 Z2009-11-25T06:07:56Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/0e4e1ded-6573-409b-a024-b6ae1156f7ebhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/0e4e1ded-6573-409b-a024-b6ae1156f7ebMike Freemanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Mike%20FreemanRetrieving database properties from a Jet databaseIs it possible to retrieve user defined Database properties from a Jet database using ADO.Net?<br/><br/>i.e. using DAO from VBA in an Access Database I can retrieve database properties using the following code;<br/><br/>z = CurrentDB.Properties(&quot;MyProperty&quot;)<br/><br/>Is there anyway to get at these properties using ADO.NET?<br/><br/>Thanks.Tue, 24 Nov 2009 16:38:25 Z2009-11-25T05:01:20Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/6683e64e-b82b-4f57-820f-f5fd49f64770http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/6683e64e-b82b-4f57-820f-f5fd49f64770composerhttp://social.msdn.microsoft.com/Profile/en-US/?user=composerSQL SP to DataGridViewThe code below takes an SQL query and loads the results into a datagridview. How do I modify this such that I can load the result set returned from a stored procedure?<br/> <br/>   try<br/>             {<br/>                 System.Data.SqlClient.SqlConnection SqlCon = new System.Data.SqlClient.SqlConnection(@myConnection);<br/>                 SqlCon.Open();<br/>                 using (SqlCommand cmd = new SqlCommand(@myYCommand, SqlCon))<br/>                 {<br/>                     using (SqlDataAdapter adap = new SqlDataAdapter(cmd))<br/>                     {<br/>                         DataTable dt = new DataTable();<br/>                         adap.Fill(dt);<br/>                         MyDataGrid.DataSource = dt;<br/>                     }<br/>                 }<br/> <br/>                 SqlCommand cmd1 = new SqlCommand(@myZCommand, SqlCon);<br/>                 myZResult = (int)cmd1.ExecuteScalar();<br/> <br/>                 myResultBox.Text = myState + &quot; returned &quot; + myZResult.ToString() + &quot; rows.&quot;;<br/> <br/>              <br/> <br/>                 SqlCon.Close();<br/>             }<br/>             catch (Exception ex)<br/>             {<br/>                 MessageBox.Show(ex.Message);<br/> <br/>             }Tue, 24 Nov 2009 17:19:39 Z2009-11-25T01:49:36Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/c57c0432-c27b-45ab-81ca-b2df76c911efhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/c57c0432-c27b-45ab-81ca-b2df76c911efMohammed Fauzihttp://social.msdn.microsoft.com/Profile/en-US/?user=Mohammed%20FauziTimeout expired. The timeout period elapsed prior to obtaining a connection from the pool<p><br>Hi</p> <p>My application is working with a DataBase server which is connected through VPN.</p> <p>Some time i get an exception like...</p> <p>&quot;Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.<br>This may have occurred because all pooled connections were in use and max pool size was reached. Inner Exception:&gt;&gt;&quot;</p> <p>Can you please let me know if you have come across any such scenario in your application &amp; any solution for it?  </p>Wed, 20 Dec 2006 10:56:43 Z2009-11-25T00:37:53Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/667e53c9-6442-4942-a2e3-71fa796cfec5http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/667e53c9-6442-4942-a2e3-71fa796cfec5OO7 James Bondhttp://social.msdn.microsoft.com/Profile/en-US/?user=OO7%20James%20BondUnable to open ODBC connection from Windows Service in .NetHi All,<br/><br/>I worte a simple windows application to connect to a third party database (pervasive / timberline) through ODBC. It is working fine but when I moved the same code to a windows service, it is unable to open the connection. I get the following error.<br/><br/>System.Data.Odbc.OdbcException<br/>   at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)<br/>   at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)<br/>   at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)<br/>   at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)<br/>   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)<br/>   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)<br/>   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)<br/>   at System.Data.Odbc.OdbcConnection.Open()<br/><br/>I installed it as a network service. The Data files for the database is kept as a shared location on the same machine and the folder has the permission for access by Network Services Account.<br/><br/>I checked the eventlog and found a couple of entries whenever there is a crash. I have listed below<br/><br/>1. Faulting application MyService.exe, version 1.0.0.0, faulting module tsSimba.dll, version 9.6.25.10, fault address 0x0001f74c.<br/><br/>2. The system has called a custom component and that component has failed and generated an exception. This indicates a problem with the custom component. Notify the developer of this component that a failure has occurred and provide them with the information below. <br/>Component Prog ID: 0[ODBC][Env 33012a0]<br/>Method Name: IDispenserDriver::CreateResource<br/>Process Name: MyService.exe<br/>Exception: C0000005<br/>Address: 0x628AF74C<br/>Call Stack: <br/>tssimba!x_dll_version + 0x1D31F<br/>tssimba!x_dll_version + 0x1DFF3<br/>tssimba!x_dll_version + 0x514B<br/>tssimba!rcCnvConvert + 0x44D<br/><br/><br/>I have tried installing the service as Local System, Local Service, User. But I kept getting the same error.<br/><br/>Please help. <br/><br/>Thanks in Advance.<br/><br/><br/>Mon, 16 Nov 2009 14:51:00 Z2009-11-24T22:40:17Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/45aa44dd-0e6f-42e5-a9d6-9be5c5c8fcd1http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/45aa44dd-0e6f-42e5-a9d6-9be5c5c8fcd1Erik11http://social.msdn.microsoft.com/Profile/en-US/?user=Erik11The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.I just installed Visual Studio 2005 today and I'm already getting an error. This code worked fine on 2003. I am running Windows XP 64 so&nbsp;I definitely have the latest MDAC. Anyone know why I would get this error?<br /><br /><br /><font size="2"><font color="#0000ff" size="2"> <p>Dim</font><font size="2"> strConnect </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">String</font><font size="2"> = </font><font color="#800000" size="2">"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="</font><font size="2"> &amp; GetWorkingPath() &amp; </font><font color="#800000" size="2">"db.mdb;Persist Security Info=False;"</p></font> <p>conn = </font><font color="#0000ff" size="2">New</font><font size="2"> OleDbConnection(strConnect)</p> <p>conn.Open()</p></font>Fri, 04 Nov 2005 22:33:26 Z2009-11-24T22:03:58Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/342a68b2-c3c0-4d5f-97d0-b8818fb9fb2ehttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/342a68b2-c3c0-4d5f-97d0-b8818fb9fb2eOrhan DUYGUhttp://social.msdn.microsoft.com/Profile/en-US/?user=Orhan%20DUYGUinsert data to access database with QueriesTableAdapter<p><strong>i have code dataset1.xsd </strong></p> <p><strong>INSERT INTO TBLURUNADI<br/>                      (URUNADI, TARIH)<br/>VALUES     (?, ?)</strong></p> <p><strong>in c# code</strong></p> <p><strong></strong></p> <p><strong>DataSet1TableAdapters.QueriesTableAdapter q = new DataSet1TableAdapters.QueriesTableAdapter(); </strong></p> <p><strong>q.InsertQuery(&quot;test1&quot;, &quot;test2&quot;);</strong></p> <p><strong>if i show on datagridview i can see my data(q.InsertQuery(&quot;test1&quot;, &quot;test2&quot;);) but not recording to the table. i cant see on table how to insert to table. this code working for sql server database but i am working with access database.</strong></p> <p><strong><br/></strong></p>Tue, 24 Nov 2009 20:16:25 Z2009-11-24T20:16:25Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/55d37dc9-8e70-431d-9729-5f8d699d84b8http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/55d37dc9-8e70-431d-9729-5f8d699d84b8CraigWMillerhttp://social.msdn.microsoft.com/Profile/en-US/?user=CraigWMillerReading a shapefile (DBF), name too long.<p>I am connecting to a GIS shapefile DBF directly with ADO.NET using the following connection string, &quot;Driver={Microsoft dBASE Driver (*.dbf)};driverid=277;dbq=M:\GISdata&quot;  I can create a dataset from a dbase datatable without problem as long is the shapefile name is shorter than 13 characters in length.  Otherwise, when I attempt to open a database named (for example) filenametoolong.shp (basename is 15 characters in length), I receive the following error message &quot;<strong>You might not have permission to perform this operation, or the object filenametoolong might no longer exist in the database.&quot;</strong>  If I have created a dataset from the the filenametoolong.dbf, I cannot use that dataset for the creation of datagrids, etc.  If I shorten the name to (for example) filenametoo.shp (base name is 11 characters in length) the file opens just file and I can see all the data.  Is there a workaround other than shortening the names of all of our many, many shapefiles?  <br/><br/>Thanks!<br/>Craig</p><hr class="sig">Salt LakeThu, 19 Nov 2009 20:43:58 Z2009-11-24T18:36:22Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/09620888-db32-4740-a443-5c2dad5e0565http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/09620888-db32-4740-a443-5c2dad5e0565Anderson Olympiohttp://social.msdn.microsoft.com/Profile/en-US/?user=Anderson%20OlympioUsing AddToBatch(), ExecuteBatch() and ClearBatch() methods from the DbDataAdpater classHi guys!<br/> Do you know something about using the AddToBatch(), ExecuteBatch() and ClearBatch() methods from the DbDataAdpater class?<br/> These are protected virtual methods and I can't acess them just instantiating this object.<br/> <br/> Do you how can I achieve this?<br/> <br/> Thanks for help,<br/> Anderson<br/>Mon, 06 Jul 2009 20:12:40 Z2009-11-24T15:35:13Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/aa1799ec-48a7-4afa-afee-e1a3ac22841ehttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/aa1799ec-48a7-4afa-afee-e1a3ac22841eEd Burrellhttp://social.msdn.microsoft.com/Profile/en-US/?user=Ed%20BurrellINSERT INTO Error - Newbie Needs HelpHi all, I am new to both C# and Databases, and am trying to use a MS ACCESS Database to store plant event data.  I have my program filling a dataset from the database, and can navigate through the database, but if I add a record, I get an error that states there is a Syntax Error in the INSERT INTO statement.  I am almost sure that the parameter statements in my BuildCommands() method have errors in them, but am having trouble figuring out what they are.  I am including the DB data fields and types along with the code here for any advice I can get.  I am using the Jet.4.0 data provider, and have st the build properties to x86 since I am using Vista 64bit OS.<br/><br/>Thanks in advance for all who help.<br/><br/>Ed.<br/><br/>Data Base Info:<br/><br/>Table - EventData<br/><br/>Fields:<br/><br/>ID - AutoNumber - Long Integer<br/>EventType - Text - 255 field size<br/>UnitNo - Integer<br/>Start - Date/Time<br/>End - Date/Time<br/>Dearte - Single<br/>Trip - Yes/No - Set to True/False<br/>Comments - Memo<br/><br/>The Program is as follows:<br/><br/> <pre lang="x-c#">using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Data; using System.Data.OleDb; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace PlantTrackerWPF { /// &lt;summary&gt; /// Interaction logic for EventWindow.xaml /// &lt;/summary&gt; public partial class EventWindow : Window { // +++ ADO.NET Objects +++ // // MS Access connection String. public static string connectionString = @&quot;Provider=Microsoft.JET.OLEDB.4.0; data source = C:\Plant Tracker\PlantTracking.mdb&quot;; private OleDbDataAdapter dataAdapter; private DataSet dataSet; private DataTable dataTable; private OleDbConnection conn; // *** END ADO.NET Objects *** // +++ Database Objects +++ private static string id; private static string eventType; private static int unitNo; private static DateTime startTime; private static DateTime endTime; private static decimal derate; private static Boolean trip; private static string comments; private int indexNumber = 0; // *** END Database Objects public EventWindow() { InitializeComponent(); eventTypeCmboBx.Items.Add(&quot;SO&quot;); eventTypeCmboBx.Items.Add(&quot;FO&quot;); eventTypeCmboBx.Items.Add(&quot;DR&quot;); // Default select command on the EventData Table. string commandString = &quot;select * from EventData&quot;; // The link between sql command and the database connection dataAdapter = new OleDbDataAdapter(commandString, connectionString); // define insert, update and delete sql commands to use. BuildCommands(); // Declare and fill the in-memory dataset from the database. dataSet = new DataSet(); dataSet.CaseSensitive = true; dataAdapter.Fill(dataSet, &quot;EventData&quot;); // Fill form with first record at loading. FillForm(indexNumber); } // *** END EventWindow *** private void FillForm(int rowID) { dataTable = dataSet.Tables[0]; DataRow dataRow = dataTable.Rows[rowID]; eventIDTxtBx.Text = dataRow[&quot;ID&quot;].ToString().Trim(); eventTypeCmboBx.Text = dataRow[&quot;EventType&quot;].ToString().Trim(); unitNoTxtBx.Text = dataRow[&quot;UnitNo&quot;].ToString().Trim(); startTxtBx.Text = dataRow[&quot;Start&quot;].ToString().Trim(); endTxtBx.Text = dataRow[&quot;End&quot;].ToString().Trim(); derateTxtBx.Text = dataRow[&quot;Derate&quot;].ToString().Trim(); commentsTxtBox.Text = dataRow[&quot;Comments&quot;].ToString().Trim(); tripChkBx.IsChecked = (Boolean)dataRow[&quot;Trip&quot;]; } // *** END FillForm *** private void BuildCommands() { //Use the select comand's connection again OleDbConnection connection = (OleDbConnection)dataAdapter.SelectCommand.Connection; //Declare a reusable insert command with parameters dataAdapter.InsertCommand = connection.CreateCommand(); dataAdapter.InsertCommand.CommandText = &quot;insert into EventData &quot; + &quot;(ID, EventType, UnitNo, Start, End, Derate, Trip, Comments) &quot; + &quot;values &quot; + &quot;(?,?,?,?,?,?,?,?)&quot;; dataAdapter.InsertCommand.Parameters.Add(&quot;ID&quot;, OleDbType.BigInt, 0, &quot;ID&quot;); dataAdapter.InsertCommand.Parameters.Add(&quot;EventType&quot;, OleDbType.Char, 0, &quot;EventType&quot;); dataAdapter.InsertCommand.Parameters.Add(&quot;UnitNo&quot;, OleDbType.Integer, 0, &quot;UnitNo&quot;); dataAdapter.InsertCommand.Parameters.Add(&quot;Start&quot;, OleDbType.Date, 0, &quot;Start&quot;); dataAdapter.InsertCommand.Parameters.Add(&quot;End&quot;, OleDbType.Date, 0, &quot;End&quot;); dataAdapter.InsertCommand.Parameters.Add(&quot;Derate&quot;, OleDbType.Decimal, 0, &quot;Derate&quot;); dataAdapter.InsertCommand.Parameters.Add(&quot;Trip&quot;, OleDbType.Boolean, 0, &quot;Trip&quot;); dataAdapter.InsertCommand.Parameters.Add(&quot;Comments&quot;, OleDbType.Char, 0, &quot;Comments&quot;); //Declare a reusable update command with parameters. dataAdapter.UpdateCommand = connection.CreateCommand(); dataAdapter.UpdateCommand.CommandText = &quot;update EventData &quot; + &quot;set EventType = ?, UnitNo = ?, Start = ?, End = ?, Derate = ?, Trip = ?, Comments = ? &quot; + &quot;where ID = ?&quot;; dataAdapter.UpdateCommand.Parameters.Add(&quot;EventType&quot;, OleDbType.Char, 0, &quot;EventType&quot;); dataAdapter.UpdateCommand.Parameters.Add(&quot;UnitNo&quot;, OleDbType.Integer, 0, &quot;UnitNo&quot;); dataAdapter.UpdateCommand.Parameters.Add(&quot;Start&quot;, OleDbType.Date, 0, &quot;Start&quot;); dataAdapter.UpdateCommand.Parameters.Add(&quot;End&quot;, OleDbType.Date, 0, &quot;End&quot;); dataAdapter.UpdateCommand.Parameters.Add(&quot;Derate&quot;, OleDbType.Decimal, 0, &quot;Derate&quot;); dataAdapter.UpdateCommand.Parameters.Add(&quot;Trip&quot;, OleDbType.Boolean, 0, &quot;Trip&quot;); dataAdapter.UpdateCommand.Parameters.Add(&quot;Comments&quot;, OleDbType.Char, 0, &quot;Comments&quot;); dataAdapter.UpdateCommand.Parameters.Add(&quot;ID&quot;, OleDbType.BigInt, 0, &quot;ID&quot;); // Declare a reusable delete command with parameters dataAdapter.DeleteCommand = connection.CreateCommand(); dataAdapter.DeleteCommand.CommandText = &quot;delete from EventData where ID = ?&quot;; dataAdapter.DeleteCommand.Parameters.Add(&quot;ID&quot;, OleDbType.BigInt, 0, &quot;ID&quot;); } // *** END BuildComands() private void exitMenuItem_Click(object sender, RoutedEventArgs e) { this.Close(); } private void Window_Loaded(object sender, RoutedEventArgs e) { //TO DO!! } private void firstRecord_Click(object sender, RoutedEventArgs e) { FillForm(0); } private void Image_ImageFailed(object sender, ExceptionRoutedEventArgs e) { } private void previousRecord_Click(object sender, RoutedEventArgs e) { if (indexNumber &gt;= 0) { indexNumber -= 1; FillForm(indexNumber); } else { MessageBox.Show(&quot;At the beginning of the database.&quot;); } } private void nextRecord_Click(object sender, RoutedEventArgs e) { if (indexNumber &lt; dataTable.Rows.Count) { indexNumber += 1; FillForm(indexNumber); } else { MessageBox.Show(&quot;At the end of the database.&quot;); } } private void lastRecord_Click(object sender, RoutedEventArgs e) { FillForm(dataTable.Rows.Count-1); } private void newRecord_Click(object sender, RoutedEventArgs e) { //Get number of records and last ID number int numberOfRows = dataTable.Rows.Count; DataRow dataRow = dataTable.Rows[numberOfRows-1]; int newIdNo = (int)dataRow[&quot;ID&quot;] + 1; eventIDTxtBx.Text = newIdNo.ToString(); eventTypeCmboBx.Text = &quot;&quot;; unitNoTxtBx.Text = &quot;&quot;; startTxtBx.Text = &quot;&quot;; endTxtBx.Text = &quot;&quot;; derateTxtBx.Text = &quot;&quot;; tripChkBx.IsChecked = false; commentsTxtBox.Text = &quot;&quot;; } private void newRecordInsert() { // Create a new row and populate it. DataRow newRow = dataTable.NewRow(); newRow[&quot;ID&quot;] = Convert.ToInt64(eventIDTxtBx.Text); newRow[&quot;EventType&quot;] = eventTypeCmboBx.Text; newRow[&quot;UnitNo&quot;] = Convert.ToInt32(unitNoTxtBx.Text); newRow[&quot;Start&quot;] = Convert.ToDateTime(startTxtBx.Text); newRow[&quot;End&quot;] = Convert.ToDateTime(endTxtBx.Text); newRow[&quot;Derate&quot;] = Convert.ToDecimal(derateTxtBx.Text); newRow[&quot;Trip&quot;] = tripChkBx.IsChecked; newRow[&quot;Comments&quot;] = commentsTxtBox.Text; //Update the database try { dataSet.Tables[&quot;EventData&quot;].Rows.Add(newRow); dataAdapter.Update(dataSet, &quot;EventData&quot;); dataSet.AcceptChanges(); // inform the user. MessageBox.Show(&quot;Update Successful&quot;); } catch(OleDbException ex) { dataSet.RejectChanges(); MessageBox.Show(ex.Message); MessageBox.Show(ex.ErrorCode.ToString()); } }// *** END nerRecordInsert *** private void saveRecord_Click(object sender, RoutedEventArgs e) { newRecordInsert(); } // *** END saveRecord_Click *** } } </pre>Mon, 23 Nov 2009 19:01:09 Z2009-11-25T03:51:33Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/edb0095a-7a26-4f13-86a3-ddf6410ee55ehttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/edb0095a-7a26-4f13-86a3-ddf6410ee55ekorklesshttp://social.msdn.microsoft.com/Profile/en-US/?user=korklessget the generated sql using dataadapterhi, i'm working with ado.net and dbdataadapeter /dbcommandbuilder.<br/> there's a way to see/log/trace the generated sql (maybe with also the sql arguments values) ?<br/> <br/> i cannot access the databas so i cannot use native db monitoringFri, 20 Nov 2009 09:05:43 Z2009-11-24T09:50:42Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d535b327-52a5-4999-995b-243acffa2e22http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d535b327-52a5-4999-995b-243acffa2e22Jim in FLhttp://social.msdn.microsoft.com/Profile/en-US/?user=Jim%20in%20FLBest new book ?Years ago I bought David Sceppa's book on ADO.NET.  I really enjoyed his style and the content in general. Now after several years of being pushed into a bit of java and websphere, I'm finally back to .NET.<br/> <br/> What's the latest really good book (along the same style/content as David's) on ADO.NET ?  I looked around all the usual sites at reviews - I even bought one.  I did notice I didn't see an 'updated' Sceppa book.<br/> <br/> Not interested too much, at least at this moment in time, in Entity Framework, LINQ etc.  I tried &quot;Visual C# 2005 Recipes&quot;.  While I didn't waste my money at all (fun book actually, the way it's laid out and written), it's just not exactly what I'm looking for.<br/> <br/> Suggestions ?<br/> <br/> Jim In FLWed, 18 Nov 2009 00:56:58 Z2009-11-25T03:21:03Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/5f713c21-cb9c-414c-a655-205414806bcahttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/5f713c21-cb9c-414c-a655-205414806bcakorklesshttp://social.msdn.microsoft.com/Profile/en-US/?user=korklesshow import data from a datatable to a database tablehi, i'm using 2 firebird database with the firebird-specific implementation of System.Data objects.<br/> the 2 db are on 2 different machine<br/> <br/> i have the same table on both the db (the difference is only in the table name and that in a case the primary-key colum is int and in the other bigint).<br/> <br/> i need to take all the record from a table and add them into the other, except for the id (primary-key column), the id of souce-column is ignored and when the row is added to the other table a new id is generated.<br/> <br/> To do that i'm puttting the data of the source table in a datatable (with a dataadapter), then i will serialize/send over the net/deserialize it.<br/> <br/> my problem is that i don't know how to add the record of the datatable to the destination table (the id is generated with a trigger before every row insertion so is not a problem). <br/> <br/> i know that i can simply iterate every datarow and explicitly set the data but maybe there's an easier way to do that (for example samething similar to dataadapter.update(datatable) ).<br/> <br/> <br/> NOTE: maybe a solution is to use dataTableOfTargetDataBase.Merge(tableWithRowsToAdd) but i think that to do that when i get the dataTableOfTargetDataBase i'm loading all the already existing rows that will kill myApplication (the destination table is very big), i'm right or there's samething as lazy loading of rows?<br/>Tue, 17 Nov 2009 14:47:39 Z2009-11-24T05:43:39Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d1018ddb-8e04-43a2-a539-4245c90a0588http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d1018ddb-8e04-43a2-a539-4245c90a0588David Tattonhttp://social.msdn.microsoft.com/Profile/en-US/?user=David%20TattonThe type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.Test it on a virtual PC running SQL 2000 on a&nbsp;Win 2003 PKLATFORM.<br />Throws the above error on win 2000 machine with a networked SQL 2000 server<br />Is this an AD thing???Tue, 07 Jun 2005 06:58:10 Z2009-11-24T01:25:10Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/df7ed731-41ba-409b-9665-931a70b71059http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/df7ed731-41ba-409b-9665-931a70b71059Robert Wernerhttp://social.msdn.microsoft.com/Profile/en-US/?user=Robert%20WernerTrying to discover correct syntax for Connection StringThere's a 10 year old VB6 app that I'm trying to get working on my local network.  The problem is that it won't connect to my local copy of SQL Server even though it has no problem doing so at a client's site and on the home network of a colleague.  To see if there was some sort of a strange problem connecting from my computer, I installed a copy of SQL Server Management Studio Express.  Into this utility app I entered the following data:<br/> <br/>  Server name:    Server\SQLExpress<br/>  Authentication:   SQL Server Authentication<br/>  Login:               Abc_Admin<br/>  Password:         abc123<br/> <br/> <em>Please note that I've altered the Login &amp; Password in this posting for security reasons but I assure they're correct in practice.</em> <br/> <br/> Then when I press Connect ... it connects properly to SQL Server as it should!  So this told me that there was no problem, in principle, with connecting to SQL Server from my test computer.<br/> <br/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <br/> <br/> So then took the key VB6 code in question and created a little procedure to try it out.  Here's the code:<br/> <br/> Private Sub TestConnection()<br/> <br/>   Dim conTest As New ADODB.Connection<br/>   Dim msg As String<br/> <br/>   On Error GoTo ConnectError<br/> <br/>  ' --------------- Connection using SQLOLEDB ----------------<br/>   With conTest<br/>     .Provider = &quot;SQLOLEDB&quot;<br/>     .ConnectionString = &quot;User ID=&quot; &amp; &quot;Abc_Admin&quot; &amp; _<br/>       &quot;;Password=&quot; &amp; &quot;abc123&quot; &amp; _<br/>       &quot;;Data Source=&quot; &amp; &quot;Server\SQLExpress&quot; &amp; _<br/>       &quot;;Initial Catalog=&quot; &amp; &quot;AbcAppDatabase&quot;<br/>     .Open<br/>   End With<br/> <br/>   MsgBox &quot;Connection Succeeded!&quot;, vbOKOnly + vbInformation, &quot;Connection Tester&quot;<br/>   conTest.Close<br/> <br/>   Exit Sub<br/> <br/> ConnectError:<br/> <br/>   msg = &quot;Status: ERROR&quot; &amp; vbCrLf &amp; vbCrLf<br/>   msg = msg &amp; &quot;Error code: &quot; &amp; Err.Number &amp; vbCrLf<br/>   msg = msg &amp; &quot;Error description: &quot; &amp; Err.Description<br/> <br/>   MsgBox msg, vbOKOnly + vbCritical, &quot;Connection Tester&quot;<br/> <br/> End Sub<br/> <br/> <br/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br/> <br/> The code always failed to connect, offering an obscure error code: -2147467259   with this description: [DBMSSOCN] General network error<br/> <br/> I have no idea what this means nor how it helps resolve the problem.<br/> <br/> Any ideas?<br/> <br/> Robert W.Sun, 15 Nov 2009 23:30:38 Z2009-11-23T22:59:26Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407Akirenhttp://social.msdn.microsoft.com/Profile/en-US/?user=AkirenLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<P>Any help would be very very much appreciated as I am about 15 hours into this :(</P> <P>Background is a development system with ASP.NET 2.0 and SQL express 2005. The server is SQL 2005 standard edition. Any ASPX pages that connect to a database results in errors.</P> <P>I have 2 identical servers with Windows server 2003, one has SQL Express and the other has SQL Server 2005 standard. that is the only difference between these systems. The scripts that work seamlessly when uploaded to the SQL Express server dont work on the SQL Server 2005</P> <P>My connection string is </P> <P>&nbsp;&lt;remove name="LocalSqlServer" /&gt;<BR>&lt;add name="LocalSqlServer" connectionString="Datasource=servername;Integrated Security=SSPI;initial catalog=C:\INETPUB\WWWROOT\test\app_data\aspnet.MDF;"<BR>&nbsp;&nbsp; providerName="System.Data.SqlClient" /&gt;</P> <P>two interesting tidbits</P> <P>1.) No matter what the initial catalog is pointing to, I get the same error. EVEN if the database doesnt exist</P> <P><EM>Cannot open database "C:\INETPUB\WWWROOT\test\app_data\aspnwet.MDF" requested by the login. The login failed.<BR>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.</EM> </P> <P>2.) second interesting thing is this, if I change the datasource to "MSSQLSERVER" which is the instance name of SQL 2005. the error changes to</P> <P><EM>An error has occurred while establishing a connection to the server. &nbsp;When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</EM> </P> <P>I have reinstalled SQL server 2005</P> <P>I have verified that under SQL Server 2005 Surface Area Configuration that remote connections has Both TCP and Named Pipes enabled</P> <P>I have verified that under the Network Configuration that the protocols for TCP/IP and Named pipes are enabled.</P> <P>I have tried atleast 20 different variations of Connectionstrings</P> <P>I have ran aspnet_regsql against the database</P> <P>I have verified that the SQL Server Browser is started</P> <P>I have verified that the TCP/IP is set in Network Configuration to default port 1433</P> <P>I have gave all authentication rights to Network Service and ASPNET accounts for testing against both the MASTER and ASPNET databases using Management Studio and attaching the Database</P> <P>I have created a custom SQL account with access to the database in question and added the username password syntax to the connectionstring and get the same login failed message. </P> <P>If anyone can give any insight that would be MUCH appreciated!! thanks in advance.<BR></P> <P>&nbsp;</P>Thu, 13 Apr 2006 17:06:51 Z2009-11-23T16:24:02Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/191f0034-6ebb-4369-96e3-96f1bf5d4964http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/191f0034-6ebb-4369-96e3-96f1bf5d4964TimHopkinshttp://social.msdn.microsoft.com/Profile/en-US/?user=TimHopkinsWhy would recordset.source return blank on certain setups but not on others?In essence the problem boils down to this, on one environment in live using COM+, this returns blank:<br/> <p><span style="font-size:x-small">Dim strSQL </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">As</span></span><span style="font-size:x-small"> </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">String</span></span><span style="font-size:x-small"> = mrsIntranetChanges.Source</span></p> Whereas running the same webpage on a local install returns the SQL that was initially being set.<br/><br/>The actual recordset has been confirmed to have contents in it so the source has obviously worked: <br/><span style="font-size:x-small">mrsIntranetChanges.RecordCount <br/></span>returns records in both environments.<br/><br/>The initial SQL used to populate it is this:<span style="font-size:x-small"><span style="font-size:x-small"> <p>mrsIntranetChanges = objPageAccess.GetIntranetRecordSetFromSQL(</p> </span></span> <p><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;select *,FieldDescription from IntranetChanges,Fields where FieldSQLName =* IntranetChangesFieldName and IntranetChangesPageName='NewEmployeeWizard.aspx' and IntranetChangesNewRecordID = &quot;</span></span><span style="font-size:x-small"> &amp; (mintRecordID).ToString)</span></p> One thing that I thought might have been relevant is that the DLL that actually gets the information from the database had the 'persist security info' property not set in it's connection string. However changing this didn't seem to have any effect.<br/><br/>This is happening on Server 2003 with IIS6 and Server 2008 with IIS7 with IE8 as the browser. It doesn't happen on a local install of 2003 server with the business logic installed locally rather than as a COM+ app (using the same browser) so this would initially point to it being something to do with the connection string?<br/><br/>However it may be some other setting on those servers as they are different machines.<br/><br/>The main reason for the question is to see if anyone's aware of known causes of this .source returning blank as I can't seem to find any out there.<br/>Fri, 20 Nov 2009 15:18:19 Z2009-11-23T13:50:39Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/ddf4519f-b69f-4d40-b2f4-fe4987305b0fhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/ddf4519f-b69f-4d40-b2f4-fe4987305b0fAdrianP07http://social.msdn.microsoft.com/Profile/en-US/?user=AdrianP07compact access 2007 databaseDoes anyone knows how to compact an access 2007 database with .net? <br><br>The previous code with JRO.JetEngine is not working for 2007 format. We used that code for previouse db but not working for the latest one.<br>Thu, 25 Jan 2007 12:26:22 Z2009-11-23T09:23:59Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/bef70b11-623b-43cc-9c8d-672c9970459dhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/bef70b11-623b-43cc-9c8d-672c9970459dIshwor Malihttp://social.msdn.microsoft.com/Profile/en-US/?user=Ishwor%20MaliAdvance Database application sampleCan anyone provide me an advance database application sample that includes generic data access using ado.net and creating a framework for such application. <div><span style="background-color:#ffffff">I actually wanna learn how to program in c#.net for multiple database platform without changing a code and </span></div> <div><span style="background-color:#ffffff">wanna learn how to create so called framework for building windows form for database applications that manages frequently used sql statements like inserting,updating and accessing multiple recordsets, validating controls, data and everything.</span></div> <div><span style="background-color:#ffffff"><br/></span></div> <div>I tried to search in google and everywhere but i couldn't find any suitable samples to download.</div> <div><br/></div> <div><br/></div> <div><br/></div> <div>Thanks in advance</div> <div><br/></div>Sun, 22 Nov 2009 11:15:55 Z2009-11-23T08:12:21Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/cc66a398-1915-45df-a247-fc63bb983860http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/cc66a398-1915-45df-a247-fc63bb983860Warez_Willyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Warez_WillyFireBird Data Provider<p>Challenge: I have VS2010 Beta2 installed. I want to connect to a datasource which is Firebird.<br/><br/>Has anyone had success doing this.<br/>I need some more detailed intsructions on how to do it (the ddex readme files are a bit vague)<br/><br/>from what I can tell the process involves<br/>Installing Firbird server<br/>gacutil - to import dll's into the gac<br/>registry mods<br/>editing of machine.config<br/><br/>I have got so far as to actually see firbird as an option in my &quot;add new data source&quot; Dialog in VS2010 Hooray!!<br/>I even get a success message on the &quot;Test&quot;<br/>but it does not connect... bombs out or I get a error<br/>&quot;Failed to find or load the registered .Net Framework Data Provider&quot;<br/><br/><br/><br/><br/></p>Wed, 18 Nov 2009 01:38:25 Z2009-11-23T00:38:51Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/355d3b81-1b0a-4b33-b138-22056a4e48d5http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/355d3b81-1b0a-4b33-b138-22056a4e48d5JamesKing77http://social.msdn.microsoft.com/Profile/en-US/?user=JamesKing77GetSchema is too slow! myDataTable = myConn.GetSchema(&quot;Columns&quot;);<br/> <br/> In my program I need to populate a list of tables in a database that belong to my application, and filter out the rest. GetSchema(&quot;Columns&quot;) returns both table and column names, so I thought I could use that data to do my filtering. However, this command takes forever to return results even on a database with a small number of tables (this is probably due to the volume of data returned - 18 columns in the datatable).<br/> <br/> All I am interested in are the &quot;TABLE_NAME&quot; and &quot;COLUMN_NAME&quot; columns returned by GetSchema, but I cannot figure out how to turn off the other columns. Can I use the restrictions to turn off these columns and speed up the response time?<br/> <br/> I can always use a datareader and query the info myself, but GetSchema seems to be quite useless if I have to go that route.Fri, 20 Nov 2009 22:07:49 Z2009-11-24T16:11:16Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/8c513514-a588-4ef3-955b-9ea641070bb1http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/8c513514-a588-4ef3-955b-9ea641070bb1chunkethttp://social.msdn.microsoft.com/Profile/en-US/?user=chunkethow to change ms access database password in c#?hi,<br> <br> how to change the ms access database password in c#? i search through the web and found one in VBA but not in C#. <a title="http://support.microsoft.com/kb/170961" href="http://support.microsoft.com/kb/170961">http://support.microsoft.com/kb/170961</a><br> <br> Please give some hints. Thank you.<br> <br> regrads,<br> chunketThu, 01 Feb 2007 01:55:27 Z2009-11-22T10:12:28Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/666835a2-50ec-415f-ba30-bb80ca51c91bhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/666835a2-50ec-415f-ba30-bb80ca51c91bMichaelMouerhttp://social.msdn.microsoft.com/Profile/en-US/?user=MichaelMouerUpdate requires a valid UpdateCommand when passed DataRow collection with modified rows.<span><span id="_ctl0_MainContent__ctl0_PostForm_PreviewBody">It is my understanding that when using a TableAdapter and selecting the proper options, Insert, Delete and Update statements are generated. The Update statement should work just using the following:<br>myTableAdapter.Update(changes);<br>Where changes is the DataSet containing the modified data.<br><br>This logic works great for one of the tables in the DB but not for another.<br><br>Learning this new stuff is Confusing at best - Frustrating at worst.<br><br>Help appreciated,<br><br>Michael<br></span></span>Tue, 21 Feb 2006 23:20:41 Z2009-11-20T16:48:36Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/6c6f0acc-37fa-43a5-adc2-1de46f9e6a25http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/6c6f0acc-37fa-43a5-adc2-1de46f9e6a25Dean Wagnerhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dean%20WagnerSessionState 2.0 Problem connecting to SQL Server<p><font color="#000000">We are attempting to upgrade from 1.1 to 2.0.  We are running SQL Server 2003, and it has SessionState 1.1 installed successfully.  We installed 2.0 on the same server, but under a different database name.  The userid and password that is used to connect to 1.1 was given dbowner permissions on the new database.  When we attempt to use the application, we get the following error: Unable to use SQL Server because ASP.NET version 2.0 Session State is not installed on the SQL server. Please install ASP.NET Session State SQL Server version 2.0 or above.<br><br>I know it's installed.  I just don't know how to determine why .net doesn't think it's installed.  What error detecting can I do?<br><br>This is the connection string we're using:<br>&lt;sessionState mode=&quot;SQLServer&quot; allowCustomSqlDatabase=&quot;true&quot; sqlConnectionString=&quot;data source=SQL1;database=aspnetdb;user id=uuuuuu;password=pppppp&quot; cookieless=&quot;false&quot; timeout=&quot;120&quot;</font><font color="#0000ff" size=2><font color="#000000" size=3>/&gt;<br><br>This exact same connection string (without the custom database stuff) works for 1.1.  I haven't found anything saying there's a problem using SQL Server 2003, or you can't run both at once.  Could someone please give me some ideas on what I can do to debug the session State and find out where the problem exists?</font></p></font>Thu, 23 Mar 2006 13:55:36 Z2009-11-20T16:19:15Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/83ae061c-c875-4bb4-9507-45c5859263bchttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/83ae061c-c875-4bb4-9507-45c5859263bcmspinder-parlechttp://social.msdn.microsoft.com/Profile/en-US/?user=mspinder-parlecHelp calling native code after calling OleDbConnection.Open on excel 2007 file<p>I think this is the right place to put this.<br/><br/>Whenever I call a OleDbConnection.Open on an excel 2007 file, any following calls to a native function that returns a string will crash the program.  This is very specific to excel 2007 files and native functions that return a string.  Also, if I call that function before Open and then again after, it will work fine.<br/><br/>I think this is best explained with code, and please tell me if I am doing anything wrong.<br/><br/>2 parts:<br/>Create an empty C++ project (testnative).<br/>Change the project so that it creates a dll.<br/>Create 1 file with the following contents.</p> <pre lang=x-cpp>__declspec(dllexport) char *test() { return &quot;asdf&quot;; }</pre> 2nd part:<br/>Create a C# executable project:<br/>Use the following code for Program.cs:<br/> <pre lang="x-c#">public static class Test { [DllImport(&quot;testnative.dll&quot;, CallingConvention = CallingConvention.Cdecl)] public extern static string test(); } static class Program { [STAThread] static void Main() { string str; // If you uncomment these lines, everything will work fine //str = Test.test(); //MessageBox.Show(str); OleDbConnection connection = new OleDbConnection( &quot;Provider=Microsoft.ACE.OLEDB.12.0;&quot; + &quot;Data Source=test.xlsx;&quot; + &quot;Extended Properties=\&quot;Excel 12.0 Xml;HDR=YES;IMEX=1\&quot;;&quot;); connection.Open(); connection.Close(); str = Test.test(); MessageBox.Show(str); } }</pre> Obviously you need an excel 2007 file called test.xlsx in there.  I have tried with a few different xlsx files with no changes.<br/><br/>The call to Test.test() will not return, and the program ends.  No debug information, it just stops.  Also, I have tried this with both .NET 2.0 and 3.5.<br/><br/>I am running Windows 7 x64 but forcing the compilation to 32 bit.<br/><br/>Any information would be greatly appreciated.<br/><br/>Thanks,<br/>Matt SpinderTue, 17 Nov 2009 21:27:09 Z2009-11-20T15:44:54Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/26eb0331-a2d3-43a2-affd-f3edf7a8b890http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/26eb0331-a2d3-43a2-affd-f3edf7a8b890JaBahttp://social.msdn.microsoft.com/Profile/en-US/?user=JaBaNamespace or type specified in the Imports 'MySql.Data.MySqlClient' doesn't contain any public member or cannot be found.<p>Dear All,</p> <p>I'm trying to connect to a MySQL server via ASP.NET 2.0 using the Visual Web Developer 2005 Express Edition. I've downloaded and installed the <a target="_blank" title="http://www.mysql.com/products/connector/net/" href="http://www.mysql.com/products/connector/net/">MySQL Connector/Net</a>.<br /><br />I'm using the following code:<font size="2"></p> <p>&lt;%</font><font color="#0000ff" size="2">@</font><font size="2"> </font><font color="#800000" size="2">Page</font><font size="2"> </font><font color="#ff0000" size="2">Language</font><font color="#0000ff" size="2">="VB"</font><font size="2"> </font><font color="#ff0000" size="2">debug</font><font color="#0000ff" size="2">="true"</font><font size="2">%&gt;</p> <p>&lt;%</font><font color="#0000ff" size="2">@</font><font size="2"> </font><font color="#800000" size="2">Import</font><font size="2"> </font><font color="#ff0000" size="2">Namespace</font><font size="2"> </font><font color="#0000ff" size="2">=</font><font size="2"> </font><font color="#0000ff" size="2">"System.Data"</font><font size="2"> %&gt;</p> <p>&lt;%</font><font color="#0000ff" size="2">@</font><font size="2"> </font><font color="#800000" size="2">Import</font><font size="2"> </font><font color="#ff0000" size="2">Namespace</font><font size="2"> </font><font color="#0000ff" size="2">=</font><font size="2"> </font><font color="#0000ff" size="2">"MySql.Data.MySqlClient"</font><font size="2"> %&gt;</p></font><font color="#0000ff" size="2"> <p>&lt;!</font><font color="#800000" size="2">DOCTYPE</font><font size="2"> </font><font color="#ff0000" size="2">html</font><font size="2"> </font><font color="#ff0000" size="2">PUBLIC</font><font size="2"> </font><font color="#0000ff" size="2">"-//W3C//DTD XHTML 1.0 Transitional//EN"</font><font size="2"> </font><font color="#0000ff" size="2">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</p> <p>&lt;</font><font color="#800000" size="2">script</font><font size="2"> </font><font color="#ff0000" size="2">language</font><font color="#0000ff" size="2">=vbscript</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">="server"&gt;</p></font><font size="2"> <p></font><font color="#0000ff" size="2">Sub</font><font size="2"> Page_Load(</font><font color="#0000ff" size="2">ByVal</font><font size="2"> sender </font><font color="#0000ff" size="2">As</font><font size="2"> Object, </font><font color="#0000ff" size="2">ByVal</font><font size="2"> e </font><font color="#0000ff" size="2">As</font><font size="2"> EventArgs)</p> <p></font><font color="#0000ff" size="2">Dim</font><font size="2"> myConnection </font><font color="#0000ff" size="2">As</font><font size="2"> MySqlConnection</p> <p></font><font color="#0000ff" size="2">Dim</font><font size="2"> myDataAdapter </font><font color="#0000ff" size="2">As</font><font size="2"> MySqlDataAdapter</p> <p></font><font color="#0000ff" size="2">Dim</font><font size="2"> myDataSet </font><font color="#0000ff" size="2">As</font><font size="2"> DataSet</p> <p></font><font color="#0000ff" size="2">Dim</font><font size="2"> strSQL </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">String</p></font><font size="2"> <p></font><font color="#0000ff" size="2">Dim</font><font size="2"> iRecordCount </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</p></font><font size="2"> <p>myConnection = </font><font color="#0000ff" size="2">New</font><font size="2"> MySqlConnection(</font><font color="#800000" size="2">"server=localhost; user id=15secs; password=Test12; database=mydatabase; pooling=false;"</font><font size="2">)</p> <p>strSQL = </font><font color="#800000" size="2">"SELECT * FROM mytable;"</p></font><font size="2"> <p>myDataAdapter = </font><font color="#0000ff" size="2">New</font><font size="2"> MySqlDataAdapter(strSQL, myConnection)</p> <p>myDataSet = </font><font color="#0000ff" size="2">New</font><font size="2"> DataSet()</p> <p>myDataAdapter.Fill(myDataSet, </font><font color="#800000" size="2">"mytable"</font><font size="2">)</p> <p>MySQLDataGrid.DataSource = myDataSet</p> <p>MySQLDataGrid.DataBind()</p> <p></font><font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">Sub</p> <p>&lt;/</font><font color="#800000" size="2">script</font><font color="#0000ff" size="2">&gt;</p> <p>&lt;</font><font color="#800000" size="2">html</font><font size="2"> </font><font color="#ff0000" size="2">xmlns</font><font color="#0000ff" size="2">="http://www.w3.org/1999/xhtml"</font><font size="2"> </font><font color="#0000ff" size="2">&gt;</p> <p>&lt;</font><font color="#800000" size="2">head</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">="server"&gt;</p></font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">title</font><font color="#0000ff" size="2">&gt;</font><font size="2">Simple MySQL Database Query</font><font color="#0000ff" size="2">&lt;/</font><font color="#800000" size="2">title</font><font color="#0000ff" size="2">&gt;</p> <p>&lt;/</font><font color="#800000" size="2">head</font><font color="#0000ff" size="2">&gt;</p> <p>&lt;</font><font color="#800000" size="2">body</font><font color="#0000ff" size="2">&gt;</p></font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">form</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">="form1"</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">="server"&gt;</p></font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">div</font><font color="#0000ff" size="2">&gt;</p></font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">DataGrid</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">="MySQLDataGrid"</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">="server"</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p></font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;/</font><font color="#800000" size="2">div</font><font color="#0000ff" size="2">&gt;</p></font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;/</font><font color="#800000" size="2">form</font><font color="#0000ff" size="2">&gt;</p> <p>&lt;/</font><font color="#800000" size="2">body</font><font color="#0000ff" size="2">&gt;</p> <p>&lt;/</font><font color="#800000" size="2">html</font><font color="#0000ff" size="2">&gt;<br /><br />When I try to view the result with CTRL+F5 there is the following error:<br /><br />Warning&nbsp;2&nbsp;Namespace or type specified in the Imports 'MySql.Data.MySqlClient' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.&nbsp;C:\Documents and Settings\Merlijn\My Documents\Visual Studio 2005\WebSites\WebSite2\MySQL.aspx&nbsp;8&nbsp;1&nbsp;C:\...\WebSite2\<br /><br />I did some research and found out the MySQL.Data.dll is somewere necesarry to build the page. I've found this dll file but I don't have any idee were I should copy this file to to make it work with Visual Web Developer 2005 Express Edition.<br /><br />Can somebody help me?<br /><br />Kind regards,<br /><br />JB</p></font>Mon, 14 Nov 2005 15:50:26 Z2009-11-20T13:30:15Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/7483b816-be7a-4204-a4d3-cfb14b2aae26http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/7483b816-be7a-4204-a4d3-cfb14b2aae26Karamasovhttp://social.msdn.microsoft.com/Profile/en-US/?user=KaramasovHow to dynamically change connection string in generated dataset class?<p>I have a project with database classes which are generated from database objects. That is I add a dataset to the project and drag and drop a database object onto it. The problem with this is that I have to give a connectionstring which is stored in the code. This is ok while developing the application. But runtime I want to use another connectionstring, both for security reasons and because each user of the application will correspond to a database user (ms sql) and shall have a corresponding connectionstring. Is there an easy way to do this without having to restore to plain all datasets and do everything myself?</p>Mon, 17 Oct 2005 11:08:36 Z2009-11-20T11:53:19Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/4b5ef0bc-9259-41f7-8a24-eeb24b8d1f9chttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/4b5ef0bc-9259-41f7-8a24-eeb24b8d1f9cWillie007http://social.msdn.microsoft.com/Profile/en-US/?user=Willie007Using System.Data.SqlClient to retrieve SQL Servers available Hi,<br/><br/>i want to build a wizard to let a user connect to a SQL server database.<br/>There for I want to show the user a list with SQL Servers found like the Add Connection in Visual Studio.<br/><br/>How can I retrieve information about SQL Servers found in my network?<br/><br/>Thanks.<br/><br/> <pre lang=x-vbnet> Dim Dbf As DbProviderFactory = DbProviderFactories.GetFactory(&quot;System.Data.SqlClient&quot;) Dim Con As DbConnection = Dbf.CreateConnection </pre>Fri, 20 Nov 2009 09:56:26 Z2009-11-20T10:44:46Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/5f4be357-ea8f-41f4-a153-dee96885c06bhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/5f4be357-ea8f-41f4-a153-dee96885c06bCode Lizardhttp://social.msdn.microsoft.com/Profile/en-US/?user=Code%20LizardCOMPlusExceptionCode 0xE0434F4E thrown executing stored procedure.<p align=left><font face=Arial size=2>I've got some code that intermittantly is throwing an error message stating that an Object reference is not set to an instance of an Object.  The inner exception message shows that it contains  _COMPlusExceptionCode -532459699 ( OxE0434F4E )</font></p> <p align=left> </p> <p align=left>Even though I've been very liberal in my use of try { } / catch { } blocks surrounding all of my calls to ADO.net table adapters, the application reports that it is &quot;An Unhandled Exception.&quot;</p> <p align=left> </p> <p align=left>* * * * *</p> <p align=left> </p> <p align=left>My code goes out to all 50 of our stores and retrieves each store's sales transaction log files as a text file.  The code then issues a BCP command against each of the 50 files to import all of this data into a single SQL Server table.  Once the BCP is completed, the program then uses a query table adapter to execute a stored procedure (which does not return any parameters.)  This stored procedure simply sets a &quot;DAYID&quot; field in all records.  (There are approximately 1.3 million records.)  </p> <p align=left> </p> <p align=left>During a typical run where this might fail, the application seems to hang for about 2 minutes (my timeout value in the connection string is set to 120 seconds) and then throws the error message.  If I wait for 5-10 minutes, I can simply restart the application (without making any other changes to anything) and it usually completes successfully.  </p> <p align=left> </p> <p align=left>The following code is a snippet from Main( ) in my code:</p> <p align=left> </p><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/****************************************/</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* run the routine to BCP the files */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* into SQL Server TLOG table */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/****************************************/</p></font></font><font size=2> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>try</p></font></font><font size=2> <p>{</p> <p>notice.AddLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;Starting BCP of data into TLog.&quot;</font></font><font size=2> );</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>if</font></font><font size=2> ( myStore == 0 )</p> <p>{</p> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>tlogBCP</font></font><font size=2>.runBCP( tgtDate, notice ); </font><font color="#008000" size=2><font color="#008000" size=2>/* BCP the raw files into SQL */</p></font></font><font size=2> <p>}</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>else</p></font></font><font size=2> <p>{</p> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>tlogBCP</font></font><font size=2>.runBCP( tgtDate, notice, myStore );</p> <p>}</p> <p>} </font><font color="#008000" size=2><font color="#008000" size=2>/* end try */</p></font></font><font size=2> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>catch</font></font><font size=2> ( </font><font color="#2b91af" size=2><font color="#2b91af" size=2>Exception</font></font><font size=2> e )</p> <p>{</p> <p>notice.AddLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;Error: Unhandled exception originated from the runBCP block!\n&quot;</font></font><font size=2> +</p> <p>e.Message.ToString( ) + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> + e.InnerException.Message.ToString( ) + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> );</p> <p>}</p> <p></font><font color="#008000" size=2><font color="#008000" size=2>/**********************************/</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* update TLOG table data to set */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* all dayid values to tgtDate */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/**********************************/</p></font></font><font size=2> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>try</p></font></font><font size=2> <p>{</p> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>Console</font></font><font size=2>.WriteLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;Running UPDATE_DAYID stored procedure.&quot;</font></font><font size=2> );</p> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>tlogBCP</font></font><font size=2>.UpdateDAYID( tgtDate, notice ); </font><font color="#008000" size=2><font color="#008000" size=2>/* sets all DAYID values in TLOG */</p></font></font><font size=2> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>Console</font></font><font size=2>.WriteLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;Running SetTLogCount stored procedure.&quot;</font></font><font size=2> );</p> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>tlogBCP</font></font><font size=2>.SetTLogCount( tgtDate, notice ); </font><font color="#008000" size=2><font color="#008000" size=2>/* routine sets TLOG_records field*/</p></font></font><font size=2> <p>}</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>catch</font></font><font size=2> ( </font><font color="#2b91af" size=2><font color="#2b91af" size=2>Exception</font></font><font size=2> e )</p> <p>{</p> <p>notice.AddLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;Error: Unhandled exception originated from the UpdateDAYID or SetTLogCount code!\n&quot;</font></font><font size=2> +</p> <p>e.Message.ToString( ) + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> + e.InnerException.Message.ToString( ) + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> );</p> <p>}</p> <p></font><font color="#008000" size=2><font color="#008000" size=2>/****************************************/</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* Now insert data from TLOG table into */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* the TLOG_ARCHIVE table */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/****************************************/</p></font></font><font size=2> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>try</p></font></font><font size=2> <p>{</p> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>AsynchSQL</font></font><font size=2>.InsertToArchive( tgtDate, notice, myStatus ); </font><font color="#008000" size=2><font color="#008000" size=2>/* insert data into TLOG_ARCHIVE */</p></font></font><font size=2> <p>}</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>catch</font></font><font size=2> ( </font><font color="#2b91af" size=2><font color="#2b91af" size=2>Exception</font></font><font size=2> e )</p> <p>{</p> <p>notice.AddLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;Error: Unhandled exception originated from the InsertToArchive block!\n&quot;</font></font><font size=2> +</p> <p>e.Message.ToString( ) + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> + e.InnerException.Message.ToString( ) + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> );</p> <p>}</p> <p></font><font color="#008000" size=2><font color="#008000" size=2>/********************************************/</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* Next step clears and inserts data from */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* TLOG into the day_sales_load table. */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/********************************************/</p></font></font><font size=2> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>try</p></font></font><font size=2> <p>{</p> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>AsynchSQL</font></font><font size=2>.DaySalesLoad( tgtDate, notice, myStatus ); </font><font color="#008000" size=2><font color="#008000" size=2>/* insert into day_sales_load */</p></font></font><font size=2> <p>}</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>catch</font></font><font size=2> ( </font><font color="#2b91af" size=2><font color="#2b91af" size=2>Exception</font></font><font size=2> e )</p> <p>{</p> <p>notice.AddLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;Error: Unhandled exception originated from the DaySaleLoad block!\n&quot;</font></font><font size=2> +</p> <p>e.Message.ToString( ) + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> + e.InnerException.Message.ToString( ) + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> );</p> <p>}</p> <p></font><font color="#008000" size=2><font color="#008000" size=2>/********************************************/</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* Next step clears and inserts data from */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/* TLOG into the FSM_SALIENT_TLOG table. */</p></font></font><font size=2> <p></font><font color="#008000" size=2><font color="#008000" size=2>/********************************************/</p></font></font><font size=2> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>AsynchSQL</font></font><font size=2>.Salient_Load( tgtDate, notice, myStatus ); </font><font color="#008000" size=2><font color="#008000" size=2>/* insert int fsm_salient_tlog */</p></font></font><font size=2> <p></font><font color="#2b91af" size=2><font color="#2b91af" size=2>AsynchSQL</font></font><font size=2>.RunSQLPlus( tgtDate, notice, myStatus ); </font><font color="#008000" size=2><font color="#008000" size=2>/* copies data into Oracle */</p></font></font><font size=2> <p>} </font><font color="#008000" size=2><font color="#008000" size=2>/* end outter-most try */</p></font></font><font size=2> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>catch</font></font><font size=2> ( </font><font color="#2b91af" size=2><font color="#2b91af" size=2>Exception</font></font><font size=2> e )</p> <p>{</p> <p>notice.AddLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;ERROR: Caught an unhandled exception in Main( ).&quot;</font></font><font size=2> );</p> <p>notice.AddLine( </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\nException: &quot;</font></font><font size=2> + e.Message + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;\n&quot;</font></font><font size=2> + </font><font color="#a31515" size=2><font color="#a31515" size=2>&quot;Inner exception: &quot;</font></font><font size=2> + e.InnerException.Message );</p> <p>notice.SendMsg( );</p> <p>}</p></font>Mon, 16 Jun 2008 18:31:48 Z2009-11-20T07:10:25Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/55141397-0de7-41ae-b333-01d6c8f8579bhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/55141397-0de7-41ae-b333-01d6c8f8579bzVinhttp://social.msdn.microsoft.com/Profile/en-US/?user=zVinAn unhandled exception ('System.Data.SqlClient.SqlException') in a windows service<p>I have a windows service which is multi threaded using a <span style="color:#2b91af;font-size:xx-small"><span style="color:#2b91af;font-size:xx-small">ThreadPool</span></span><span style="font-size:xx-small">.QueueUserWorkItem</span> , that does some data capture from several other databases. The service for the production environment runs in a 2003 server which has multiple processors. Every now and then almost once every week (not consistent), I get an error. This error does not get trapped in any of my error handling code. My development box has XP, I have run this service on it for several days but never have encountered this error.<br/><br/>A maximum of 4 threads are spawned during each run. All threads attempt to update/delete/insert two tables, but never the same record.<br/><br/>The service crashes and the only entry is in the Application Event Viewer.<br/><br/>Event Type: Error<br/>Event Source: .NET Runtime 2.0 Error Reporting<br/>Event Category: None<br/>Event ID: 5000<br/>Date:  9/18/2009<br/>Time:  3:22:38 AM<br/>User:  N/A<br/>Computer: DP01ABRE<br/>Description:<br/>EventType clr20r3, P1 salesincentivedatacapture.exe, P2 1.0.0.0, P3 4a9beed3, P4 system.data, P5 2.0.0.0, P6 4889deaf, P7 2490, P8 2c, P9 system.data.sqlclient.sql, P10 NIL.</p> <p>For more information, see Help and Support Center at <a href="http://go.microsoft.com/fwlink/events.asp">http://go.microsoft.com/fwlink/events.asp</a>.<br/>Data:<br/>0000: 63 00 6c 00 72 00 32 00   c.l.r.2.<br/>0008: 30 00 72 00 33 00 2c 00   0.r.3.,.<br/>0010: 20 00 73 00 61 00 6c 00    .s.a.l.<br/>0018: 65 00 73 00 69 00 6e 00   e.s.i.n.<br/>0020: 63 00 65 00 6e 00 74 00   c.e.n.t.<br/>0028: 69 00 76 00 65 00 64 00   i.v.e.d.<br/>0030: 61 00 74 00 61 00 63 00   a.t.a.c.<br/>0038: 61 00 70 00 74 00 75 00   a.p.t.u.<br/>0040: 72 00 65 00 2e 00 65 00   r.e...e.<br/>0048: 78 00 65 00 2c 00 20 00   x.e.,. .<br/>0050: 31 00 2e 00 30 00 2e 00   1...0...<br/>0058: 30 00 2e 00 30 00 2c 00   0...0.,.<br/>0060: 20 00 34 00 61 00 39 00    .4.a.9.<br/>0068: 62 00 65 00 65 00 64 00   b.e.e.d.<br/>0070: 33 00 2c 00 20 00 73 00   3.,. .s.<br/>0078: 79 00 73 00 74 00 65 00   y.s.t.e.<br/>0080: 6d 00 2e 00 64 00 61 00   m...d.a.<br/>0088: 74 00 61 00 2c 00 20 00   t.a.,. .<br/>0090: 32 00 2e 00 30 00 2e 00   2...0...<br/>0098: 30 00 2e 00 30 00 2c 00   0...0.,.<br/>00a0: 20 00 34 00 38 00 38 00    .4.8.8.<br/>00a8: 39 00 64 00 65 00 61 00   9.d.e.a.<br/>00b0: 66 00 2c 00 20 00 32 00   f.,. .2.<br/>00b8: 34 00 39 00 30 00 2c 00   4.9.0.,.<br/>00c0: 20 00 32 00 63 00 2c 00    .2.c.,.<br/>00c8: 20 00 73 00 79 00 73 00    .s.y.s.<br/>00d0: 74 00 65 00 6d 00 2e 00   t.e.m...<br/>00d8: 64 00 61 00 74 00 61 00   d.a.t.a.<br/>00e0: 2e 00 73 00 71 00 6c 00   ..s.q.l.<br/>00e8: 63 00 6c 00 69 00 65 00   c.l.i.e.<br/>00f0: 6e 00 74 00 2e 00 73 00   n.t...s.<br/>00f8: 71 00 6c 00 20 00 4e 00   q.l. .N.<br/>0100: 49 00 4c 00 0d 00 0a 00   I.L.....<br/></p>Fri, 18 Sep 2009 18:18:13 Z2009-11-20T00:06:27Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/56c88985-ee0a-4be9-8750-25d2770cf58dhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/56c88985-ee0a-4be9-8750-25d2770cf58dsashismehttp://social.msdn.microsoft.com/Profile/en-US/?user=sashismeHow to check if a column exists in a datareader<p>I'm up against this problem for which I'm surprised to find no help.</p> <p>I want to check if a column exists in the datareader before attempting to read it. If i don't check i get the indexOutofRange exception.</p> <p>There is similar functionality with datatable where we do dt.Columns.IndexOf(&quot;ColName&quot;)</p> <p>But how do we do this with datareader???</p>Tue, 12 Dec 2006 10:45:45 Z2009-11-19T18:31:41Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/0093bc96-c646-4e23-bf07-5ae1b0ac3119http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/0093bc96-c646-4e23-bf07-5ae1b0ac3119Bfundyhttp://social.msdn.microsoft.com/Profile/en-US/?user=BfundySQLBulkCopy and unique identity columnsI have a CSV file that looks something like this:<br/>date, title, type<br/>2009-11-01, myTitle, buy<br/><br/>My SQL table looks something like this:<br/>unique identifyer with newid(), date, title, type<br/><br/>SQLBulkInsert is working perfectly if I do NOT have the unique ID column.   How can I make SQLBulkCopy work in import while allowing SQL to assign a newid to each row?<br/><br/>Here is my code:<br/><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><font size=2 color="#0000ff"><font size=2 color="#0000ff"> <p>using</p> </font></font></span><font size=2 color="#0000ff"> <p> </p> </font></span> <p><span style="font-size:x-small"> (</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">SqlConnection</span></span><span style="font-size:x-small"> cn = </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">new</span></span><span style="font-size:x-small"> </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">SqlConnection</span></span><span style="font-size:x-small">(</span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;myconnection&quot;</span></span><span style="font-size:x-small">)) <p>{</p> <p>cn.Open();</p> </span></p> <span style="font-size:x-small"><font size=2> <p> </p> </font></span> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">using</span></span><span style="font-size:x-small"> (</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">SqlBulkCopy</span></span><span style="font-size:x-small"> copy = </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">new</span></span><span style="font-size:x-small"> </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">SqlBulkCopy</span></span><span style="font-size:x-small">(cn)) <p>{</p> <p>copy.ColumnMappings.Add(0, 0);</p> <p>copy.ColumnMappings.Add(1, 1);</p> <p>copy.ColumnMappings.Add(2, 2);</p> <font size=2> <p>copy.DestinationTableName =</p> </font></span></p> <p><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;table&quot;</span></span><span style="font-size:x-small">; <p>copy.WriteToServer(dt);</p> <p>}</p> <p>cn.Close();</p> <p>}</p> </span></p>Tue, 17 Nov 2009 23:22:31 Z2009-11-19T06:24:36Z