ADO.NET DataSet ForumQuestions and discussion about data platform development using ADO.NET DataSet and LINQ to DataSet.© 2009 Microsoft Corporation. All rights reserved.Sat, 28 Nov 2009 18:49:04 Zd30e694c-a286-4349-a8aa-7f6945748ab6http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/99ce943a-37d6-4324-8d98-8697955cb9abhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/99ce943a-37d6-4324-8d98-8697955cb9abChristopher Piszhttp://social.msdn.microsoft.com/Profile/en-US/?user=Christopher%20PiszLINQ - Full outter join on many subqueriesI googled and saw alot of left outter joins and one big long function to outter join two existing tables, but I am trying to convert a huge complicated mess of a sql function into LINQ and it requires a full outter join of the results from 5 queries.<br/><br/>It's basically different accounting totals that were calculated. Any of them could be null and the user wants to see it as 0s for that total.<br/><br/>So, let's say I already have queries for &quot;var total1, var total2, var total3, var total4, and var total 5&quot;<br/>Each has an ID and an amount.<br/><br/>How do I accomplish that in LINQ?<br/><br/>Sat, 28 Nov 2009 18:49:04 Z2009-11-28T18:49:04Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/d9af0d75-5c7f-44a9-8f20-cddcf611c646http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/d9af0d75-5c7f-44a9-8f20-cddcf611c646IamHuMhttp://social.msdn.microsoft.com/Profile/en-US/?user=IamHuMCompare two Tables data for each row...<p>hi,</p> <p> I have two tables (say ParentTable &amp; ChildTable).<br/> Both tables are having same columns.</p> <p> Now i want to compare the ChildTable data with ParentTable. How i can compare the data for each row of child table and store the result in a list of bool... The  result will be 'TRUE' for a row if the data matches and result will be 'FALSE' if there is any mismatch in the data.</p> <p> Is there is any in build method to do it...? If not which is the fastest the way to do this comparison...?</p> <p>Thanks in advancs,<br/>IamHuM</p>Sat, 28 Nov 2009 07:49:32 Z2009-11-28T17:34:15Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/fff1c5db-9bb9-4164-9a47-b6ee7c6f988chttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/fff1c5db-9bb9-4164-9a47-b6ee7c6f988cItalian Cousinhttp://social.msdn.microsoft.com/Profile/en-US/?user=Italian%20CousinHow can I set a foreign key point to nothing?Environment: C#, Visual Studio 2008, .NET 3.5, SQL Server 2005 Express Ed.<br/> <br/> If I want to set a table with a foreign key NULL, I raise an exception.<br/> If I set the foreign key to 0, I raise another exception because the parent row doesn't exist.<br/> So what can I do to achieve this result?<br/> <br/> I don't want to create a parent row specific for a NOTHING item, please don't ask me that.<br/> <br/> Thx for answers.<hr class="sig">------- Life is what happens while doing other projects -------Sat, 28 Nov 2009 16:19:39 Z2009-11-28T17:10:26Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/52075d88-92fa-4ae7-bf86-ae2b8511662bhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/52075d88-92fa-4ae7-bf86-ae2b8511662bTekitohttp://social.msdn.microsoft.com/Profile/en-US/?user=TekitoCreate Access 2003 tables from DatasetI have a bunch of datatables and I want to create and copy these tables into a new Access 2003 database.  I think I know how to create and connect to the Access database, but is there a way to automatically create an Access table using the datatable schema?  <br/><br/>I found this discussion here:  <a href="http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/0b7fcec7-10db-4c9e-872e-f03ed745e2a9?prof=required">http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/0b7fcec7-10db-4c9e-872e-f03ed745e2a9?prof=required</a>  where people talk about using &quot;SELECT INTO&quot;, but how would you do that query with a datatable?Wed, 25 Nov 2009 17:18:59 Z2009-11-27T06:52:09Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/7bf8b1e7-e737-4c24-852a-407c964eee99http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/7bf8b1e7-e737-4c24-852a-407c964eee99sambomartinhttp://social.msdn.microsoft.com/Profile/en-US/?user=sambomartinHelp with XSD.EXE - xsd file containing a choice?<span style="font-family:Verdana, Arial, Helvetica;font-size:small">Hello, <br/><br/>I'm trying to create a dataset object from an xsd. <br/><br/>The xsd contains this: <br/>&lt;xsd:choice&gt; <br/>&lt;xsd:sequence&gt; <br/>&lt;xsd:element name=&quot;StartRange&quot; type=&quot;AONrangeStructure&quot;/&gt; <br/>&lt;xsd:element name=&quot;EndRange&quot; type=&quot;AONrangeStructure&quot; minOccurs=&quot;0&quot;/&gt; <br/>&lt;xsd:element name=&quot;Description&quot; type=&quot;AONdescriptionType&quot; minOccurs=&quot;0&quot;/&gt; <br/>&lt;/xsd:sequence&gt; <br/>&lt;xsd:element name=&quot;Description&quot; type=&quot;AONdescriptionType&quot;/&gt; <br/>&lt;/xsd:choice&gt; <br/><br/>When executing xsd, the error thrown says that A column named 'Description' <br/>already belongs to this DataTable. Does this mean that xsd.exe doesn't deal <br/>with xsd:choices? <br/><br/>Any help appreciated. <br/><br/>TIA <br/>Sam</span>Thu, 26 Nov 2009 14:51:40 Z2009-11-26T16:34:05Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/8052e57c-e09d-4dce-bfa6-49f4b629d1b7http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/8052e57c-e09d-4dce-bfa6-49f4b629d1b7Robtykettohttp://social.msdn.microsoft.com/Profile/en-US/?user=RobtykettoVb.net 2008 - System.data.enumerablerowcollection(of system.data.datarow) convert to string?Greetings,<br/> <br/> For no shortage of trying I am unable to convert the contents of a datarow (containing xml data) to type string.<br/> <br/> Using .tostring results in conversion syntax errors in the linq code and when adding the LINQ result as an xml element to an xmldocument the literal words systems.data.datarow (see code below for examples) appears.<br/> <br/> Is it possible from the linq to extract the datatable rows containg xml and then write them to an xmldocument as xmlelements?<br/> <br/> Apologies if this is the wrong section to post but the problem involves both LINQ selection from a datatable and XML.<br/> <br/> Linq Code:-<br/> <pre lang=x-vbnet>Dim quotes = From quote In frmMainQuote.quoteData.Tables(&quot;quote&quot;).AsEnumerable _ Select quote _ Where (quote.Item(&quot;category&quot;).ToString = cboCategory.SelectedItem.ToString) _ And (quote.Item(&quot;author&quot;).ToString = txtAuthor.Text) _ And (quote.Item(&quot;text&quot;).ToString Like &quot;*&quot; &amp; txtKeyword.Text &amp; &quot;*&quot;) _ And (quote.Item(&quot;date&quot;).ToString = dtpQuoteDate.Value.ToString(&quot;dd MMMM yyyy&quot;)) </pre> Code to convert the content of the datarow(s) to xml (when examing the xmldocument it contains the word system.data.datarow or similar) :-<br/> <br/> <pre lang=x-vbnet> Dim outQuoteDoc As New XDocument(New XElement(&quot;quotefile&quot;, quotes)) 'Or Dim outQuoteDoc As New XDocument(New XElement(&quot;quotefile&quot;, quotes.toString))</pre> <br/> Thanks<br/> Rob<br/> <br/>Thu, 26 Nov 2009 10:57:21 Z2009-11-26T11:49:38Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/213263a0-8f79-4ce0-ac45-7b131e049753http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/213263a0-8f79-4ce0-ac45-7b131e049753urania musehttp://social.msdn.microsoft.com/Profile/en-US/?user=urania%20musecreating new ms access db with tablesHi all<br/>I have a small app I am working on with c# and access. now I want to have the option to &quot;save as&quot; the db <br/>1. to create copy of current db and to save it somewhere else(progrematicly)<br/>2.to create completly new db , with the structure (tables, key...) of the existing db in the project. I find in google how to create new db, but how do I create the tables and everything?is there a way to do it from wxisting db , or do I need to run sql?<br/>tnxSat, 17 Oct 2009 16:36:47 Z2009-11-26T10:11:26Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/4b9df675-4e76-4739-9314-9ed0e7778937http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/4b9df675-4e76-4739-9314-9ed0e7778937rock007http://social.msdn.microsoft.com/Profile/en-US/?user=rock007doubt<span class=Apple-style-span style="word-spacing:0px;font-family:Verdana;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;text-transform:none;text-indent:0px;white-space:normal;letter-spacing:normal;border-collapse:collapse"><span class=Apple-style-span style="word-spacing:0px;font-family:Verdana;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;text-transform:none;text-indent:0px;white-space:normal;letter-spacing:normal;border-collapse:collapse">one dropdownlist is of some <strong>state</strong> names and other one is of <strong>city</strong> of that state<span class=Apple-converted-space> </span> <br/> <br/> so if user select any State then all the city should be come into 2nd dropdownlist (DropDownList2).<span class=Apple-converted-space> <br/> <br/> i have written the program below but the problem is when i first select ,first state it doesnt display and again i select another state,</span> displays and again i select first state displays...why it happening<br/> <br/> public void PopulateDropDownListStates(string state)<br/>     {<br/>         string sql = &quot;stat&quot;;<br/>         SqlCommand cmd = new SqlCommand();<br/>         SqlDataAdapter da = new SqlDataAdapter(cmd);<br/>         DataTable ds = new DataTable();<br/> <br/>         SqlParameter st = new SqlParameter(&quot;@state&quot;, SqlDbType.VarChar);<br/>         cmd.Parameters.AddWithValue(&quot;@state&quot;,state);<br/>         <br/>         cmd.Connection = conn;<br/>         cmd.CommandType = CommandType.StoredProcedure;<br/>         cmd.CommandText = sql;<br/>         <br/>         conn.Open();<br/>         da.Fill(ds);<br/>         <br/> <br/>         if (ds.Rows.Count &gt; 0)<br/>         {<br/>             DropDownList2.DataSource = ds;<br/>             DropDownList2.DataTextField = &quot;city&quot;;<br/>             DropDownList2.DataValueField = &quot;city&quot;;<br/>             DropDownList2.DataBind();<br/>         }<br/>         conn.Close();<br/>         <br/> <br/>     }<br/> <br/>     protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)<br/>     {<br/>        PopulateDropDownListStates(DropDownList1.SelectedItem.Value.ToString());<br/>     }<br/> </span> </span>Thu, 26 Nov 2009 06:03:53 Z2009-11-26T09:41:37Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/c98d5831-2bab-44f4-b75d-cf79c896c1b1http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/c98d5831-2bab-44f4-b75d-cf79c896c1b1Jonathan Chaihttp://social.msdn.microsoft.com/Profile/en-US/?user=Jonathan%20ChaiBundled SQL ServerHello guys, not sure if this has been asked before, but I'll ask anyway. I am developing an application. Currently, I have added a .mdf database via the solution explorer. I have done the settings correctly and I am able to connect to the said database. <br/> I have written code to write to the database using data adapter insert command. I have also included a data reader just to see if the data is correctly inserted. <br/> <br/> Now, so far, I have not run into any errors while debugging + running. I can successfully read what has been inserted. I am curious, however, as to why the data no longer exists in the database after I terminate the program and run it again. Also, in the server explorer, I do not see any data recorded in the database. Why is this so? Is this normal? Does it mean that everything the application is closed, the database resets itself? I need help urgently. Thanks.Fri, 20 Nov 2009 12:05:31 Z2009-11-26T03:31:59Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b3661c76-d473-41d6-8fcc-94635936a224http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b3661c76-d473-41d6-8fcc-94635936a224Christopher Piszhttp://social.msdn.microsoft.com/Profile/en-US/?user=Christopher%20PiszDataSet - when the view you want doesn't match tables in DBI am new to C# and ADO in general, so I am having trouble even forming my question...<br/><br/>Currently I have a form that allows the user to modify some data in the database. I created 2 classes that contain the data as I would present it to the user. There are several convoluted quieries and procedures I have to call in order to get that data in usable form for the user.<br/><br/>I have a feeling my code is messy because I am trying to manually sync my class instances with the grid contrlols on the form and handle events at the same time. So, I figure it would be easier to just use data sets that sync automatically with the controls.<br/><br/>My problem is all the examples show datasets with tables that are an exact match with what's in the database. They are examples, so I can see the simplicity. How do you go about handling data that needs to be &quot;transformed&quot; as it is put into the dataset?<br/><br/>Wed, 25 Nov 2009 19:18:00 Z2009-11-26T00:34:29Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/f2182eb6-54df-4f6f-946f-b8beda22b06ehttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/f2182eb6-54df-4f6f-946f-b8beda22b06eFrequentCoderhttp://social.msdn.microsoft.com/Profile/en-US/?user=FrequentCoderCustom conversions for DataSet Merge (untyped to strongly typed)?Hello, <div><br/></div> <div>I am trying to merge an untyped DataSet into a strongly typed DataSet.</div> <div><br/>The two DataSets have the same table and column names, but the column data types are different in some cases -- so, the call to Merge() fails.</div> <div><br/></div> <div>The untyped DataSet actually has the correct <em>values </em>for each column, only the data type is wrong (for example, string instead of double).</div> <div><br/></div> <div>When I was converting this manually, I could simply call Convert.ToDouble(sourceTable[&quot;ColumnName&quot;]), and get the right value.  But obviously, Merge() doesn't do this automatically.</div> <div><br/>So, can I somehow create a custom converter to pass to Merge(), or is there another way to merge these data sets without going through each table and column manually?</div> <div><br/></div> <div>Thanks</div>Mon, 23 Nov 2009 17:35:13 Z2009-11-25T17:52:58Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/c342a5bf-3aaf-4a70-a556-ec6e2ba32be1http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/c342a5bf-3aaf-4a70-a556-ec6e2ba32be1Scott_Changhttp://social.msdn.microsoft.com/Profile/en-US/?user=Scott_ChangLINQ to SQL-pubs Console application: 3 errors in Lambda Expression - Why? How to solve them?Hi all,<br/><br/>In my Visual C# 2008 Express, I created a LINQ to SQL-pubs Console application with the following code:<br/> <pre lang="x-c#">using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Diagnostics; using System.ComponentModel; using System.Data; namespace LinqLambdaConsoleLee442 { class Program { static void Main(string[] args) { SqlConnection conn; SqlCommand comm; SqlDataAdapter adapter; DataSet ds = new DataSet(); //---loads the Authors table into dataset--- conn = new SqlConnection(@&quot;Data Source=NAB-WK-02554356\SQLSCOTT;&quot; + &quot;Initial Catalog=pubs;Integrated Security=True&quot;); comm = new SqlCommand(&quot;SELECT * FROM Authors&quot;, conn); adapter = new SqlDataAdapter(comm); adapter.Fill(ds); var query = ds.Tables[0].AsEnumerable() .Count (a =&gt; a.Field&lt;string(&quot;State&quot;) == &quot;CA&quot;); Console.WriteLine(query); Console.ReadLine(); } } } </pre> <p>I got the following 3 errors immediately:</p> <p>Error 1 'System.Data.EnumerableRowCollection&lt;System.Data.DataRow&gt;' does not contain a definition for 'Count' and the best extension method overload 'System.Linq.Enumerable.Count&lt;TSource&gt;(System.Collections.Generic.IEnumerable&lt;TSource&gt;, System.Func&lt;TSource,bool&gt;)' has some invalid arguments C:\Documents and Settings\e1enxshc\My Documents\Visual Studio 2008\Projects\LinqLambdaConsoleLee442\LinqLambdaConsoleLee442\Program.cs 29 17 LinqLambdaConsoleLee442<br/>Error 2 Argument '2': cannot convert from 'lambda expression' to 'System.Func&lt;System.Data.DataRow,bool&gt;' C:\Documents and Settings\e1enxshc\My Documents\Visual Studio 2008\Projects\LinqLambdaConsoleLee442\LinqLambdaConsoleLee442\Program.cs 29 25 LinqLambdaConsoleLee442<br/>Error 3 Invalid expression term 'string' C:\Documents and Settings\e1enxshc\My Documents\Visual Studio 2008\Projects\LinqLambdaConsoleLee442\LinqLambdaConsoleLee442\Program.cs 29 44 LinqLambdaConsoleLee442<br/><br/>Please help and tell me why I got these three errors and how I can solve them.<br/><br/>Thanks,<br/>Scott Chang </p> <p> </p>Tue, 24 Nov 2009 12:55:35 Z2009-11-25T12:29:10Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/cf9e8bee-65a6-4700-b64e-7687b2ee54adhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/cf9e8bee-65a6-4700-b64e-7687b2ee54adahmet kuruhttp://social.msdn.microsoft.com/Profile/en-US/?user=ahmet%20kuruHelp: Millions of Rows no T-SQL only ADO.NET (and C#) !Hi all,<br/> <br/> I am working in financial reporting for an insurance company and i have to generate a complex report. I will try to describe the problem as clearly as i can. Please ask for details if any further information needed. Your comments and replies are appreciated. <br/> <br/> The General Frame:<br/> <ul> <li>We currently hold our data in an Oracle DB.</li> <li>As a finance user i do not have any rights on this DB other than select, not on the production system; we do have a nightly copy for reporting. </li> <li>In our current organization, business intelligence is nearly taking no attraction so requesting any improvements from IT stuff does not work.</li> <li>Unfortunately our parent company demands really detailed reports which can not be handled in our current structure in DB.</li> </ul> The Task:<br/> <ul> <li>We need to report the development in our written premium (or sales shortly and more comfortably).</li> <li>This report intends to control the rate of lapsed business' from the last year and structure of the business for the current year.</li> <li>To generate the report i need to start with the sales of the previous year,</li> <li>Eliminate the contracts which can not be renewed (the ones covering more/less than one year),</li> <li>Eliminate the contracts which were in charge last year but canceled at some point up to day,</li> <li>Determine the remaining business from the last year,</li> <li>Determine which contracts are renewed,</li> <li>Determine the status of the current year's business in two categories: renewed or new business</li> <li>This report also requires 5 dimensions like customer category, product group, region etc. </li> </ul> Technical Details:<br/> <ul> <li>I have no option to utilize the DB like creating temp tables and running queries in SPs and filling those tables due to access limitations.</li> <li>I have to inspect <strong>each contract</strong> to categorize it as described above.</li> <li>More over, i have to compare the set of contracts for the last and current year to determine if they are renewed or not.</li> <li>Roughly there are more than<strong> 1 million</strong> rows for each year.</li> </ul> Current Program:<br/> <ul> <li>I used C# express to create a WinForm application to collect input from user such as for which date the report is going to be prepared and where to be saved. </li> <li>Project is targeting .net 3.5 </li> <li>I used Oracle client to access data.</li> <li>I created 2 queries to get the the contracts into a <strong>typed</strong> dataset both for last year and current year.</li> <li>The queries run rather long but keeping the data taken it is acceptable.</li> <li>Data is returned as <strong>sorted</strong> .</li> <li>From now on, i do not use the DB. Everything is executed in the local machine. </li> <li>Once i download the data to local dataset in the memory, i start to loop <strong>(foreach loop)</strong> over the rows for the last year testing the conditions i described above and assign a category. </li> <li>I use a function testing some fields of decimal and string with connected if <strong>(if/else if/else)</strong> statements.</li> <li>This function also checks the last years contract in the current years rows using multiple fields like product code, arrangement date and customer code.(I can not just join the queries, i have already considered that) </li> <li>This part involves <strong>LINQ</strong> . I am not very experienced with LINQ, i have created the queries before i get into the loop but not sure if it is caching the results. </li> <li>I also collect the IDs of contracts which are marked as renewed.</li> <li>Using the collected IDs, i again loop over the rows but for the current year this time and i mark them accordingly whether new business or not.</li> <li>After i group the data and save the aggregated figures to an  excel file.</li> </ul> The Problem:<br/> <ul> <li>the first loop processing the last year's data is taking too much time to get out of the loop.</li> <li>The second loop relatively exits faster than the first but is not in an acceptable situation either.</li> </ul> My Lack of Knowledge/Points to Consider:<br/> <ul> <li>I accept in advance that the resources in my local machine (a simple work station) may not be suitable for a task like this.</li> <li>I have never worked with a dataset like this before, it is relatively large for me.</li> <li>I have never had a performance consideration due to small datasets.</li> <li>I may have overloaded the program with the typed dataset, i used it just to save time. I do not need most of it except a clear row definition. I just did not want go into another loops for a custom object and a datareader.</li> <li>I do not have to much experience with LINQ, it is just easier to code, therefore i just picked it up to run crosschecks between the two years' data.</li> </ul> To sum up, i need to process lots of rows out of the DB and i am not so experienced in this sort of performance-minded/data-intensive tasks and my solution is useless at this point.<br/> I want to thank in advance for your time, help, comment and suggestions. <hr class=sig> akrSat, 21 Nov 2009 21:18:23 Z2009-11-27T09:26:29Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/17349cde-0898-435b-9572-77df0aca55b0http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/17349cde-0898-435b-9572-77df0aca55b0Jean Greyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Jean%20GreyHow to refresh XSD file when datasource (access db) is changedHi,<br/><br/>I've generated an XSD file using access database as its datasource.<br/>However, I need to change the db schema.<br/>I need to add a few more columns and modify some data types.<br/>Is there a way of updating my XSD file without creating it again?<br/><br/>Regards,<br/><br/>Jean GreyTue, 24 Nov 2009 02:13:58 Z2009-11-25T02:26:08Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/76b9a55f-e999-4380-b50c-f970a010b998http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/76b9a55f-e999-4380-b50c-f970a010b998RameshSabbanihttp://social.msdn.microsoft.com/Profile/en-US/?user=RameshSabbaniHow to insert dataset into Oracle database directlyI have one Excel sheet.<br/>I am loading data from excel sheet to a dataset.<br/>Now i want to insert this dataset to oracle database table directly.<br/><br/>Can you suggest me?<br/><br/>My code goes here-----<br/><br/>Excel sheet name:Book1<br/>Oracle Table Name:Import1<br/><span style="font-size:x-small"><span style="font-size:x-small"> <p>OracleConnection destination=</p> </span></span> <p><span><span style="font-size:x-small;color:#0000ff">new</span> OracleConnection();<br/></span><span><span style="font-size:x-small;color:#0000ff">string</span> lsConnectionString = ConfigurationSettings.AppSettings[&quot;CCMdsn&quot;]; <br/>destination.ConnectionString=lsConnectionString;<br/></span><span><span style="font-size:x-small;color:#0000ff">if</span>(destination.State != ConnectionState.Open) <br/>{<br/>destination.Open();<br/>}<br/><span style="font-size:x-small">OracleTransaction trans=</span></span><span><span style="font-size:x-small;color:#0000ff">null</span>; <br/><span style="font-size:x-small">OracleCommand command1 =</span></span><span><span style="font-size:x-small;color:#0000ff">new</span> OracleCommand(&quot;Select * from import1&quot;, destination);<span style="font-size:x-small"> <br/>OracleDataAdapter adapter =n</span></span><span><span style="font-size:x-small;color:#0000ff">ew</span> OracleDataAdapter(command1); <br/><span style="font-size:x-small">DataSet dataSet =</span></span><span><span style="font-size:x-small;color:#0000ff">new</span> DataSet(); <br/></span><span><span style="font-size:x-small;color:#0000ff">int</span> b =adapter.Fill(dataSet, &quot;import1&quot;);<br/></span><span><span style="font-size:x-small;color:#0000ff">string</span> excelConnectionString = @&quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\loader\Book1.xls; Extended Properties=&quot;&quot;Excel 8.0;HDR=YES&quot;&quot;&quot;; <br/><span style="font-size:x-small">OleDbConnection source =</span><span style="font-size:x-small;color:#0000ff">new</span> OleDbConnection(excelConnectionString); <br/>source.Open();<br/></span><span><span>OleDbCommand command =new</span> OleDbCommand(&quot;SELECT * FROM [Book1$]&quot;, source); <br/>o<span style="font-size:x-small">leDbDataAdapter dataAdapter =</span></span><span><span style="font-size:x-small;color:#0000ff">new</span> OleDbDataAdapter(command);<br/><span style="font-size:x-small;color:#0000ff">int</span> a =dataAdapter.Fill(dataSet, &quot;import1&quot;); <br/></span><span><span>OracleCommandBuilder builder =new</span> OracleCommandBuilder(adapter);<br/>trans = destination.BeginTransaction();<br/>command1.Transaction = trans;<br/>adapter.InsertCommand = builder.GetInsertCommand();<br/></span><span><span style="font-size:x-small;color:#0000ff">int</span> check = adapter.Update(dataSet, &quot;import1&quot;); <br/>trans.Commit();<br/></span><span><span style="font-size:x-small;color:#0000ff">if</span>(destination.State == ConnectionState.Open) <br/>destination.Close();<br/></span><span style="font-size:x-small">source.Close(); <br/><br/><br/>It is executing with out any error.But database table is not updating with any changes.</span></p>Thu, 12 Nov 2009 11:35:38 Z2009-11-24T16:31:25Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/2f3453f3-ec3f-44a1-a059-f2593e61d610http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/2f3453f3-ec3f-44a1-a059-f2593e61d610bobteschhttp://social.msdn.microsoft.com/Profile/en-US/?user=bobteschAdding column to dataset via designer causes "cannot find the parent relation" exceptionI have added two columns to a rather complex dataset via the designer.  When I execute an add record against this dataset the app throws an exception with the message &quot;Cannot find the parent relation&quot;.  I have been all thru the code and the relation is defined.  I have deleted the relation and readded it with the same exception being thrown.  I have done many searches and found that this is an existing issue that was supposedly resolved.  However, I have also found additional posting on connect.microsoft... that people are still seeing this issue in current VS releases including VS 2008 SP1, which is what I am running.Mon, 16 Nov 2009 23:19:45 Z2009-11-23T21:06:38Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/e1fc140b-bf05-4635-ba2d-3c74a426f287http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/e1fc140b-bf05-4635-ba2d-3c74a426f287Ying06http://social.msdn.microsoft.com/Profile/en-US/?user=Ying06% in queryI create a table adapter to fill a datatable in dataset. <br/><br/>The query defined in the table adapter is:<br/>select * from orders where orderno like @orderno<br/><br/>When running the fill method, I passed &quot;%3%&quot; as the parameter value. However, no row returned. I couldn't get anything even I used &quot;%&quot;.<br/><br/>daorders.fill(&quot;%&quot;)<br/><br/>Is there any one knows why?<br/><br/>Fri, 20 Nov 2009 17:42:05 Z2009-11-27T02:33:34Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/05b11366-bd8d-4475-9a92-86fb7e92103chttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/05b11366-bd8d-4475-9a92-86fb7e92103cHyun-jik Baehttp://social.msdn.microsoft.com/Profile/en-US/?user=Hyun-jik%20BaeIdentifying every field type in a table programmably<div>I want to retrieve every field type in a table in a program.<br/><br/>We tried this by <strong>select top 0 * from Table </strong>with ADO recordset and found that many types can be identified by reading Fields[].Type value.<br/>However, some field types show incorrect results, for example, <strong>Date </strong>type in SQL Server is shown as <strong>VarWChar </strong>in ADO Fields[].Type value.<br/>How can I retrieve correct field type list of a table?<br/><br/>Thanks in advance.</div>Wed, 18 Nov 2009 07:05:38 Z2009-11-25T00:38:50Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b56bfba9-c766-466d-956f-aebab0129305http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b56bfba9-c766-466d-956f-aebab0129305Tom Pricehttp://social.msdn.microsoft.com/Profile/en-US/?user=Tom%20PriceHow to do aggregates with a groupby against a datatableHow can I accomplish the equivalent of this SQL query in C# against an ado.net datatable<br/> <br/> insert resulttable select a, sum(a) as b, count(*) as n from c group by a<br/> <br/> Thanks in advance...Fri, 20 Nov 2009 22:58:46 Z2009-11-27T02:34:15Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/f8f4a6a3-5d11-498c-83c0-730449ade395http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/f8f4a6a3-5d11-498c-83c0-730449ade395jimbarstowhttp://social.msdn.microsoft.com/Profile/en-US/?user=jimbarstowHandling large tables with datarelationsSuppose I have multiple tables for which I created DataRelation objects in a DataSet which describe a hierarchical relationship. The tables are all very large. I have a query which limits the number of records for the root table and it fills very quickly. How do I fill the dependent tables without reading all of their data? This fill needs to be driven off the records selected by the original query. (Doing this basically requires doing all the joins to determine the appropriate records in the dependent tables.) Everything I've found on google basically assumes that you load all the data from the dependent tables but that is not feasible.<br/> <br/> Am I trying to do something that just isn't appropriate with a DataSet? It seems like the only real alternative to reading all the data is to use a DataReader but it seems like I'll lose the power of the DataRelations and the hierarchical DataSet.Fri, 20 Nov 2009 18:33:45 Z2009-11-27T02:32:56Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/67e341c1-c9c1-447b-aafa-5c50df889a22http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/67e341c1-c9c1-447b-aafa-5c50df889a22naweezhttp://social.msdn.microsoft.com/Profile/en-US/?user=naweezvb cod convert in C#<div>i have vb6  function how to convert in c# , can u help me   </div> <div><br/></div> <div>i have filled combox</div> <div><br/></div> <div> <div>            cmbItemCategory.DataSource = ds.Tables[0];</div> <div>            cmbItemCategory.DisplayMember = &quot;Description&quot;;</div> <div>            cmbItemCategory.ValueMember = &quot;CategoryID&quot;;</div> <div><br/></div> <div>now i want to display description in combobox but i have saved in database value member</div> </div> <div><br/></div> <div>Function FindNameInCombo(code As String, ComboName As ComboBox) As Integer</div> <div> Dim i As Integer</div> <div> i = 0</div> <div> For i = 0 To ComboName.ListCount - 1</div> <div><br/></div> <div> If ComboName.ItemData(i) = Val(code) Then</div> <div> ComboName.ListIndex = i</div> <div> FindNameInCombo = ComboName.ListIndex</div> <div>   </div> <div> Exit Function</div> <div> End If</div> <div> Next</div> <div>  End Function  </div>Thu, 19 Nov 2009 06:02:45 Z2009-11-23T05:42:07Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/1586c443-3051-420c-9263-e70ec25d5325http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/1586c443-3051-420c-9263-e70ec25d5325Enrique HTC S710http://social.msdn.microsoft.com/Profile/en-US/?user=Enrique%20HTC%20S710CRUD Example with Dataset, DataRow and Access MdbI've created (using a wizzard, don't remember which) a dataset that points to a mdb file (Access 2007)<br/> The generated DataSet is named &quot;EstacionarDataSet&quot;<br/> <br/> Here's some code I have:<br/> <br/> <pre lang="x-c#">EstacionarDataSet ed = new EstacionarDataSet(); DataRow newRow = ed.Tables[0].NewRow(); newRow[&quot;patente&quot;] = tb_Patente.Text; newRow[&quot;numerobox&quot;] = tb_Box.Text; newRow[&quot;fechahora_ingreso&quot;] = DateTime.Now; ed.Tables[0].Rows.Add(newRow);</pre> * The above code is executed in SecondForm (not mainform). I'm trying to insert a new record into the only table mdb file has (this code doesn't work, but doesn't give any exception).<br/> <br/> * The mainform contains a System.Windows.Forms.DataGridView component, attached to this mdb file, which works fine, it shows the records correctly, etc. (PS: I added some sample records using Access)<br/> <br/> * I guess the wizzard has created all the necessary code, connectionstring, etc. Project source code is available here<br/> <a href="http://www.mediafire.com/?zwotmgwvzii">http://www.mediafire.com/?zwotmgwvzii</a> <br/> <br/> * I'm needing some code samples for adding a new row, updating, and deleting... Thanks<hr class="sig">Beza - Custom Joomla TemplatesFri, 13 Nov 2009 11:51:45 Z2009-11-19T14:37:38Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/54e9c5f4-8ff4-46a7-ba94-9c4b4161f35fhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/54e9c5f4-8ff4-46a7-ba94-9c4b4161f35fScott_Changhttp://social.msdn.microsoft.com/Profile/en-US/?user=Scott_ChangLINQ to ADO.NET-LINQ to DataSet in Windows Forms: Accessing Data of Typed DataSet and UnTyped DataSet & Presenting the Data in DataGridView Hi all,<br/><br/>In my Visual C# 2008 Express, the followimg code of LINQ to DataSet Console application works nicely:<br/> <pre lang="x-c#">using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Diagnostics; using System.ComponentModel; using System.Data; namespace LINQ_ConsoleLee439 { class Program { static void Main(string[] args) { SqlConnection conn; SqlCommand comm; SqlDataAdapter adapter; DataSet ds = new DataSet(); //---loads the Authors table into dataset--- conn = new SqlConnection(@&quot;Data Source=NAB-WK-02554356\SQLSCOTT;&quot; + &quot;Initial Catalog=pubs;Integrated Security=True&quot;); comm = new SqlCommand(&quot;SELECT * FROM Authors&quot;, conn); adapter = new SqlDataAdapter(comm); adapter.Fill(ds); foreach (DataRow row in ds.Tables[0].Rows) { Console.WriteLine(&quot;{0} &lt;=&gt; {1} {2}&quot;, row[&quot;au_id&quot;], row[&quot;au_fname&quot;], row[&quot;au_lname&quot;]); } //---Using LINQ to DataSet--- //---query for authors living in CA--- var authors = (from author in ds.Tables[0].AsEnumerable() where author.Field&lt;string&gt;(&quot;State&quot;) == &quot;CA&quot; select new { ID = author.Field&lt;string&gt;(&quot;au_id&quot;), FirstName = author.Field&lt;string&gt;(&quot;au_fname&quot;), LastName = author.Field&lt;string&gt;(&quot;au_lname&quot;) }).ToList(); Console.ReadLine(); } } }</pre> <p>I got the desired output of 23 items of the Authors living in CA (of pubs database) in the Console screen without any problem.</p> <p>Now I try to do the same LINQ to DataSet, but print the output in the Windows Forms DataGridView in 2 ways:</p> <p>#1-Accessing the &quot;Authors&quot; data of pubs database as Typed DataSet (i.e. creating the .xsd file in the Solution Explorer) and presenting the &quot;Author_ID&quot;, &quot;Author_firstName&quot;, and &quot;Author_lastName&quot; living in CA in the DataGridView. <br/>#2-Accessing the &quot;Authors&quot; data of pubs database as UnTyped DataSet (i. e. without creating the .xsd file in the Soultion Explorer) and presenting the &quot;Author_ID&quot;, &quot;Author_firstName&quot;, and &quot;Author_lastName&quot; living in CA in the DataGridView. <br/><br/>I have difficulties of LINQ query in the both ways:<br/>For #1: How can I create a data view? How can I set the DataSource property of the binding source for the DataGridView to the data view?<br/>For #2: How can I create the UnTyped DataSet, Data Adapter, and Binding Source in code?<br/><br/>I read the following articles:<br/>Article #1: Creating a DataView Object (LINQ to DataSet) in http://msdn.microsoft.com/en-us/library/bb669080.aspx<br/>Article #2: LINQ to ADO.NET-LINQ to DataSet (Filling a Typed DataTable with the CopyToDataTable Method) in <a href="http://en.csharp-online.net/LINQ_toADO.NET%E2%80%94LINQ_to_DataSet">http://en.csharp-online.net/LINQ_toADO.NET%E2%80%94LINQ_to_DataSet</a><br/>Article #3: An useful sample of LINQ to DataSet (to perform filtering od data against an untyped daraset) in <a href="http://www.dmm888.com/Blog/linq2.html">http://www.dmm888.com/Blog/linq2.html</a><br/>Article #4: Adding UnTyped DataSets to a Form or Component in http://msdn.microsoft.com/en-us/cwefee50.aspx<br/><br/>I am very confused with the above-mentioned LINQ techniques and coding.  Please help and advise.<br/><br/>Thanks,<br/>Scott Chang<br/><br/>P. S.  The following code is my first attemp to do LINQ to UnTyped DataSet that gives me the Windows Forms output with an umpty DataGridView:</p> <pre lang="x-c#">using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using System.Diagnostics; using System.Linq; using System.Data; //using AuthorDisplay.DataSetLee439TableAdapters; //using System.Data.Linq; //using System.Data.Linq.Mapping; namespace LINQ_Lee439 //namespace LINQtoDataSet (Lee's Book: Page 439) { public partial class Form1 : Form { public Form1() { InitializeComponent(); } // [Table(Name = &quot;PubsAuthorNames&quot;)] public class PubsAuthorNames { public string au_id { get; set; } public string au_fname { get; set; } public string au_lname { get; set; } } private void Form1_Load(object sender, EventArgs e) { SqlConnection conn; SqlCommand comm; SqlDataAdapter adapter; DataSet ds = new DataSet(); //---loads the Authors table into dataset--- conn = new SqlConnection(@&quot;Data Source=NAB-WK-02554356\SQLSCOTT;&quot; + &quot;Initial Catalog=pubs;Integrated Security=True&quot;); comm = new SqlCommand(&quot;SELECT * FROM Authors&quot;, conn); adapter = new SqlDataAdapter(comm); adapter.Fill(ds); MessageBox.Show(ds.Tables[0].Rows.Count.ToString()); //per Yichun Feng //---Using LINQ to DataSet--- //---query for authors living in CA--- var authors = (from author in ds.Tables[0].AsEnumerable() where author.Field&lt;string&gt;(&quot;State&quot;) == &quot;CA&quot; select new { ID = author.Field&lt;string&gt;(&quot;au_id&quot;), FirstName = author.Field&lt;string&gt;(&quot;au_fname&quot;), LastName = author.Field&lt;string&gt;(&quot;au_lname&quot;) }).ToList(); MessageBox.Show(authors.Count.ToString()); //per Yichun Feng //---bind to a datagridview control--- this.dataGridView1.AutoGenerateColumns = true; this.dataGridView1.DataSource = authors; } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { SqlConnection conn; SqlCommand comm; SqlDataAdapter adapter; DataSet ds = new DataSet(); //---loads the Authors table into dataset--- conn = new SqlConnection(@&quot;Data Source=NAB-WK-02554356\SQLSCOTT;&quot; + &quot;Initial Catalog=pubs;Integrated Security=True&quot;); comm = new SqlCommand(&quot;SELECT * FROM Authors&quot;, conn); adapter = new SqlDataAdapter(comm); adapter.Fill(ds); MessageBox.Show(ds.Tables[0].Rows.Count.ToString()); //per Yichun Feng //---Using LINQ to DataSet--- //---query for authors living in CA--- var authors = (from author in ds.Tables[0].AsEnumerable() where author.Field&lt;string&gt;(&quot;State&quot;) == &quot;CA&quot; select new { ID = author.Field&lt;string&gt;(&quot;au_id&quot;), FirstName = author.Field&lt;string&gt;(&quot;au_fname&quot;), LastName = author.Field&lt;string&gt;(&quot;au_lname&quot;) }).ToList(); MessageBox.Show(authors.Count.ToString()); //per Yichun Feng //---bind to a datagridview control--- this.dataGridView1.AutoGenerateColumns = true; this.dataGridView1.DataSource = authors; } } } </pre> <p><br/>       </p> <p> <br/></p>Tue, 17 Nov 2009 15:21:56 Z2009-11-19T13:36:59Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b63d373d-f72b-46de-aafe-c8217e9f161bhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b63d373d-f72b-46de-aafe-c8217e9f161bScott_Changhttp://social.msdn.microsoft.com/Profile/en-US/?user=Scott_ChangLINQ to ADO.NET-LINQ to DataSet (pubs) in Console application: Why " where author.Field<string>("State") == "CA" " fails?Hi all,<br/><br/>In my Visual C# 2008 Express, I ran the following code:<br/> <pre lang="x-c#">using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Diagnostics; using System.ComponentModel; using System.Data; namespace LINQ_ConsoleLee439 { class Program { static void Main(string[] args) { SqlConnection conn; SqlCommand comm; SqlDataAdapter adapter; DataSet ds = new DataSet(); //---loads the Authors table into dataset--- conn = new SqlConnection(@&quot;Data Source=NAB-WK-02554356\SQLSCOTT;&quot; + &quot;Initial Catalog=pubs;Integrated Security=True&quot;); comm = new SqlCommand(&quot;SELECT * FROM Authors&quot;, conn); adapter = new SqlDataAdapter(comm); adapter.Fill(ds); foreach (DataRow row in ds.Tables[0].Rows) { Console.WriteLine(&quot;{0} &lt;=&gt; {1} {2}&quot;, row[&quot;au_id&quot;], row[&quot;au_fname&quot;], row[&quot;au_lname&quot;]); } //---Using LINQ to DataSet--- //---query for authors living in CA--- var authors = (from author in ds.Tables[0].AsEnumerable() where author.Field&lt;string&gt;(&quot;State&quot;) == &quot;CA&quot; select new { ID = author.Field&lt;string&gt;(&quot;au_id&quot;), FirstName = author.Field&lt;string&gt;(&quot;au_fname&quot;), LastName = author.Field&lt;string&gt;(&quot;au_lname&quot;) }).ToList(); Console.ReadLine(); } } } </pre> <p>It gave me all the 23 Authors living in CA, IN, MD, TN, OR, KS, UT, MI that is not the code statement <span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><font size=2 color="#0000ff"><font size=2 color="#0000ff"> <p>where</p> </font></font></span><font size=2 color="#0000ff"> <p> </p> </font></span></p> <p><span style="font-size:x-small"> author.Field&lt;</span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">string</span></span><span style="font-size:x-small">&gt;(</span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">&quot;State&quot;</span></span><span style="font-size:x-small">) == </span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">&quot;CA&quot;<font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span></p> <p>orders!!??<br/><br/><br/>Please help and tell me what is wrong in the code of my LINQ query.<br/><br/>Thanks,<br/>Scott Chang </p> <p> </p>Tue, 17 Nov 2009 19:54:35 Z2009-11-19T13:21:11Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/e32cc790-6242-4a64-b5cf-5b7f013999d7http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/e32cc790-6242-4a64-b5cf-5b7f013999d7Scott_Changhttp://social.msdn.microsoft.com/Profile/en-US/?user=Scott_ChangLINQ to SQL-pub Windows Application in Visual C# 2008 Express: No error and no output of 3 columns in dataGridView!! Why?Hi all,<br/>In my Visual C# 2008 Express, I created a Windows Forms application &quot;LINQ-Lee439&quot; with the following code:<br/> <pre lang="x-c#">using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using System.Diagnostics; namespace LINQ_Lee439 //namespace LINQtoDataSet (Lee's Book: Page 439) { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { SqlConnection conn; SqlCommand comm; SqlDataAdapter adapter; DataSet ds = new DataSet(); //---loads the Authors table into dataset--- conn = new SqlConnection(@&quot;Data Source=NAB-WK-02554356\SQLSCOTT;&quot; + &quot;Initial Catalog=pubs;Integrated Security=True&quot;); comm = new SqlCommand(&quot;SELECT * FROM Authors&quot;, conn); adapter = new SqlDataAdapter(comm); adapter.Fill(ds); //---Using LINQ to DataSet--- //---query for authors living in CA--- var authors = (from author in ds.Tables[0].AsEnumerable() where author.Field&lt;string&gt;(&quot;State&quot;) == &quot;CA&quot; select new { ID = author.Field&lt;string&gt;(&quot;au_id&quot;), FirstName = author.Field&lt;string&gt;(&quot;au_fname&quot;), LastName = author.Field&lt;string&gt;(&quot;au_lname&quot;) }).ToList(); //---bind to a datagridview control--- this.dataGridView1.AutoGenerateColumns = true; this.dataGridView1.DataSource = authors; } } } </pre> <p>From the ToolBox, I dragged a DataGridView to the surface of Form1. It did not have any compilation errors. I executed this project. It ran and the Form1 appeared, but the dataGridView1 was empty!!!  I do not know what is wrong with this project.  Please help and advise.</p> <p>Thanks,</p> <p>Scott Chang    </p>Tue, 20 Oct 2009 14:49:55 Z2009-11-19T13:14:37Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/539a907d-f440-4ca3-acfd-c9cc3e22b28bhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/539a907d-f440-4ca3-acfd-c9cc3e22b28bSrishti123http://social.msdn.microsoft.com/Profile/en-US/?user=Srishti123insert csv file into the sqltableI am writing a program by which it reads the data from the csv file and insert data into the sql table. and the program is running successfully. but i am getting one bug that it not reads the first row of the file. <br><br>program: <br>        <br>        OdbcConnection cnx;<br>        System.Data.DataTable dt = new System.Data.DataTable();<br>        OdbcDataAdapter da = new OdbcDataAdapter();<br>        OdbcCommand cmd;<br>        string cnxStr;<br>        string CSVFolder;<br>        CSVFolder = &quot;c:\\CSVFolder&quot;;<br>        cnxStr = &quot;Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=&quot; + CSVFolder + &quot;;&quot;;<br>        cnx = new OdbcConnection(cnxStr);<br>        cmd = new OdbcCommand(&quot;Select * from [junk.txt] &quot;, cnx);<br>        da.SelectCommand = cmd;<br>        cnx.Open();<br>        da.Fill(dt);<br>        foreach (System.Data.DataRow dr in dt.Rows)<br>        {<br>            if (Convert.ToString(dr[0]).Length &gt; 0 &amp;&amp; Convert.ToString(dr[1]).Length &gt; 0)<br>            {<br>                //sql insertion command  here<br>            }<br>        }<br><br>note: suppose if the file contains the three rows<br><br>1, sudhir<br>2, bharti<br>3, raj<br><br>it is counting the total row as 2, it leaves the first row (1, sudhir)<br><br>and ideas?<br><br><br><br><br><br><br> Fri, 09 Jan 2009 12:47:02 Z2009-11-19T08:31:27Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/3d34aedf-9573-48b9-a370-70c0da410c28http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/3d34aedf-9573-48b9-a370-70c0da410c28Zubair Khalidhttp://social.msdn.microsoft.com/Profile/en-US/?user=Zubair%20KhalidLINQ with DataTableI am using LINQ on datatable and select distinct Column from data table<br/> but when i use following code then i got incomplete string in str. i think its due to ASEnumerable().<br/> if a character is repeating in value then its skipped!<br/> i dont understand, why its happened? <br/> Can any one tell me how can i select distinct data values from a data table using LINQ?<br/> <pre> var query = (from rec in this.Objects.Tables[0].AsEnumerable() select rec.Field&lt;String&gt;(&quot;TblName&quot;).Distinct().ToList()); foreach (var row in query) { String str = new String(row.ToArray()); }</pre> <br/><hr class="sig">Zubair KhalidWed, 18 Nov 2009 10:10:37 Z2009-11-19T07:00:42Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/18266dab-8d2f-4b7d-80b3-be4d4cddbc9dhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/18266dab-8d2f-4b7d-80b3-be4d4cddbc9dFredHerringhttp://social.msdn.microsoft.com/Profile/en-US/?user=FredHerringDataTable SelectI am working in vb2008.  I need to query a datatable.  <br/><br/>Dim FoundRows as datarow()=maindatatable.select()<br/><br/>I need to extract all the rows where StructureID = 2000 where RecordType = Record in ascending order.  Please help me with the correct format for a datatable.select  ?<br/><br/>Thanks,<br/>FredWed, 18 Nov 2009 18:43:58 Z2009-11-24T00:27:44Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/a388043f-0e55-4495-8e7f-e092fd14edd0http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/a388043f-0e55-4495-8e7f-e092fd14edd0akram mellIcehttp://social.msdn.microsoft.com/Profile/en-US/?user=akram%20mellIceDataTable.Copy() throws exception for tables with relationsHi there, <div><br/></div> <div>there is a problem in the Copy method in the DataTable if the table has relations.</div> <div><br/></div> <div>ie: if we make table A and table B and relate them by a relation, then we add to table A column based on expression like &quot;Parent(TableBRelation).Name&quot;, when we copy table A to new table C it throws an exception in the Copy method says that he can't find the &quot;TableBRelation&quot; relation.</div> <div><br/></div> <div>any one help please?</div> <div><br/></div> <div><br/></div><hr class="sig">Akram MellIceWed, 28 Oct 2009 12:14:42 Z2009-11-18T19:51:23Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/08f44bf6-aa6d-4441-a281-a511f779c05bhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/08f44bf6-aa6d-4441-a281-a511f779c05bNaYaRhttp://social.msdn.microsoft.com/Profile/en-US/?user=NaYaRFailed to enable constrains problemhi<br/> am making an inventory program with vb.net 2008 and sql server 2008, the database contains several tables , two of them are the Items and the Companies , each linked in a different forum but they have a foreign key relationship between comapnyID at the companies and the one at the items which appears at the forum as a combobox to display the name instead of the ID, the problem is when i add a new item and save it , it is saved but when i come back to load the items fourm the FAMOUS error appears ,(failed to enable constrains )  so i throught a try catch at the item fourm load sub, so after the error occur , i get into the items forum , i get to see the item i just added but without the company name(companyID)<br/> what should i do ??Wed, 11 Nov 2009 05:37:10 Z2009-11-18T05:06:51Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/77790162-ad63-4959-9bc4-42a2517e8dbdhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/77790162-ad63-4959-9bc4-42a2517e8dbdJaedenRuinerhttp://social.msdn.microsoft.com/Profile/en-US/?user=JaedenRuinerSqlDbType - and the Sql Server numeric(X,X) typeIn the VB and C# ADO.Net interaction with SQL Server, there is the SqlDbType which basically gives a reference of the <em>actual</em> Sql Server type as opposed the the converted (or interpreted) .Net System.Type.  Thus  SqlDbType.NvarChar becomes a string with a length limiter, while SqlDbType.Money becomes a Decimal type, and so forth.  <br/> <br/> However, when dealing with certain elements of SQL Server, one can define their own numerical type, such as:<br/>   numeric(3,0)  <br/> which basically allows a whole number from 0 to 999.  How does .Net interpret this?  How does it handle the implications and data verification when going to and from the server.  is there some backside handler that is instigated to make sure the number 3000 isn't updated to a column of only 3 digit magnitude?  Does Sql Server just truncate these values on its own?  <br/> <br/> Thanks<br/> Jaeden &quot;Sifo Dyas&quot; al'Raec Ruiner<hr class="sig">&quot;Never Trust a computer. Your brain is smarter than any micro-chip.&quot;Fri, 13 Nov 2009 19:55:46 Z2009-11-17T22:20:19Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b61e4dee-5fd8-4d67-bb67-ce361560e3d9http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b61e4dee-5fd8-4d67-bb67-ce361560e3d9IamHuMhttp://social.msdn.microsoft.com/Profile/en-US/?user=IamHuMCopy few column data from one table to another...<p>Hi,</p> <p>I have two tables in my application(Table1 and Table2).<br/>Table1 - Coulm1, Column2, Column3 Column4, Column5<br/>Table1 is having some records(say 50 rows).</p> <p>I want to copy few records from first table to second table.<br/>But i want to copy only 3 column data for all rows from first table(Table1) to second table(Table2).</p> <p>What is the quickest and easiest way to do this...?</p> <p>Thanks,<br/>IamHuM</p>Tue, 17 Nov 2009 05:34:49 Z2009-11-23T02:16:22Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/a6a61a9d-22ba-49e8-a313-0847d3afe761http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/a6a61a9d-22ba-49e8-a313-0847d3afe761CodeSlingerhttp://social.msdn.microsoft.com/Profile/en-US/?user=CodeSlingerWhy does Dataset.GetChanges() return all the tables when one row was deleted?I am pulling my hair out on this one.<br/> <br/> I have 18 SQL Server 2008 tables loaded into a 3.5 DataSet via Fill calls by the SqlDataAdapter. I have removed all the relations, got rid of the FillSchema calls, called AcceptChanges, verified that GetChanges returns null and still when the Infragistics data grid deletes one row from one table, when I call GetChanges again, I get all 18 of my tables returned in the DataSet copy albeit most of the tables return a 0 count for the Tables.Rows.Count property. Still I need to know exaclty what tables have changed. Many of these tables are related in the actual database but this table has only a couple relations with other tables, and none of those relations are defined in this case. I have debugged from &quot;before row deleted&quot; to &quot;after row deleted&quot; in Infragistics grid and there are no more calls into my data layer unless somehow the DataSet object is grabbed from the DataTable I gave the grid.<br/> <br/> Would appreciate any help with this.<br/> <br/> Thanks, DaveTue, 10 Nov 2009 07:05:21 Z2009-11-17T17:08:18Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/18eec755-a9ab-45ae-afb5-7058d7f4af15http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/18eec755-a9ab-45ae-afb5-7058d7f4af15shachar8http://social.msdn.microsoft.com/Profile/en-US/?user=shachar8join 2 datatables and get a datatable from the join (linq to dataset)hi all.<br/>i cant find an example of how to create a join between 2 datatables, select some fields from that join and then return a datatable from this.<br/>in an msdn example  i can get from this join a list, but i need a datatable because i need to use dataview on it, filter it and set it as the datasource of my datagridview.<hr class="sig">shacharTue, 17 Nov 2009 05:56:02 Z2009-11-23T02:16:45Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/568a7805-2aee-4c48-b2f4-06d9abc95360http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/568a7805-2aee-4c48-b2f4-06d9abc95360kicajhttp://social.msdn.microsoft.com/Profile/en-US/?user=kicajDataView.RowFilter cannot find rows.Hi!<br/><br/>Why in sample below DataView is empty ? In table is row &quot; a a &quot; and filter is also the same but DataView is empty.<br/><br/> <pre lang="x-c#"> DataSet1 ds = new DataSet1(); ds.DataTable1.AddDataTable1Row(&quot; a a &quot;); ds.AcceptChanges(); DataView view = new DataView(ds.DataTable1); view.RowFilter = string.Format(&quot;Name LIKE '%{0}%'&quot;, &quot; a a &quot;); Console.WriteLine(view.Count.ToString()); Console.ReadKey();</pre> <br/><br/>Regards!Mon, 09 Nov 2009 08:32:39 Z2009-11-17T05:57:20Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b614a040-391b-42d1-a331-2a161efde35ehttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/b614a040-391b-42d1-a331-2a161efde35eLucho_1981http://social.msdn.microsoft.com/Profile/en-US/?user=Lucho_1981New dataviews property change event not raised. bug fixed for 4.0 but how about 3.5? what can we do now?<span style="font-size:8pt;color:black;line-height:115%;font-family:'Verdana','sans-serif'">understand that the bug fix on the propertychangeevent not raised on new Dataviews has been fixed for .net 4.0.<br/><br/>But we are still utilizing 3.5 and dataviews and datarowviews are quite important specially when working with wpf. Could you provide us with a patch or a bug fix or a good workaround? <br/><br/>Utilizing the defaultview everywhere works but it is simply a not feasible solution when binding the same dataset to multiple wpf controls everywhere in the system.<br/><br/>Hopefully we can get a fix on this important issue for 3.5</span><hr class="sig">LuisTue, 17 Nov 2009 02:26:28 Z2009-11-17T02:26:31Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/3dda9eee-1a21-44de-9b2c-15f4d29e9ebehttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/3dda9eee-1a21-44de-9b2c-15f4d29e9ebeSinixhttp://social.msdn.microsoft.com/Profile/en-US/?user=SinixPlease, approve the bug! Please, approve the bug!<br>The link:<br><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=389689">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=389689</a><br><br>Description:<br>When you're binding to a more than one DataView on the same table directly, event notifcations stops working.<br><br>Strangelly, this issue doesn't occurs when binding via WinForm's BindingSource and specifiyng DataSet as source and table name as member.<br><br>Some links:<br>other problems related to dataView:<br>https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=314279<br>(my report, no reaction, just closed):<br>-and-<br>https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361248<br><br>My previous report (no reaction, just closed):<br>https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=339740&amp;SiteID=212<br><br>Threads on MSDN Forums: // I'll create new one soon, see the comments<br>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/33442f0d-96a2-402c-91c4-d4c7b991c93a<br>-and-<br>http://forums.msdn.microsoft.com/en-US/wpf/thread/737889e6-6315-4d72-9563-8104b5e0429f<br><br>P.S.<br>This post will be duplicated on another threads, because the bug touches implementation of binding at WPF and WinForms.<br><br>Please, help me contact directly with ADO.NET or WPF Testing teams. I've feedbacked this bug first time 8 month ago and there is no reaction but &quot;there is no workaround&quot;.<br><br>my mail: sinix DOT 2005 AT gmail DOT com.<br><br>Thanks!<br>Fri, 26 Dec 2008 07:46:02 Z2009-11-17T01:31:06Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/c1d43bb3-b67b-41fd-836c-6e33a52b84c9http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/c1d43bb3-b67b-41fd-836c-6e33a52b84c9Billy Bob Richerthttp://social.msdn.microsoft.com/Profile/en-US/?user=Billy%20Bob%20RichertTableAdapterManager.Connection.ConnectionStringHi!<br /><br />I'm currently trying to use a typed TableAdapterManager, but I need to change the connection string that is originally supplied (the one I set in the designer) at runtime. I tried setting the TableAdapterManager.Connection.ConnectionString property, thinking that it would propagate that value to each TableAdapter. This did not happen, only 1 of the 3 TA's connectionstrings was changed, the other 2 still had the value I supplied in the designer.<br /><br />What am I doing wrong? Should I manually set each connection string for each TA? If so, what is the purpose of TableAdapterManager.Connection?<br /><br />Thank you!Tue, 13 Oct 2009 20:00:52 Z2009-11-16T16:13:14Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/9ba61ea3-b32e-46c9-8251-e33d90f7b3d1http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/9ba61ea3-b32e-46c9-8251-e33d90f7b3d1akram mellIcehttp://social.msdn.microsoft.com/Profile/en-US/?user=akram%20mellIceHandle SqlInjection in DataView.RowFilterHi,<br/><br/>How to handle sql injection in row filter property.<br/><span style="font-size:x-small"><span style="font-size:x-small"> <p>table.DefaultView.RowFilter =</p> </span></span> <p><span style="font-size:xx-small"><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;NAME LIKE '&quot;</span></span><span style="font-size:x-small"> + filterString + </span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;%'&quot;</span></span></span><span style="font-size:x-small"><span style="font-size:xx-small">;<br/><br/>is filterString can be injected??<br/>and if yes how can this handled?</span></span></p><hr class="sig">Akram MellIceMon, 16 Nov 2009 11:49:16 Z2009-11-16T15:40:00Zhttp://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/a394c4a5-af16-4a28-8523-9ca15e932982http://social.msdn.microsoft.com/Forums/en/adodotnetdataset/thread/a394c4a5-af16-4a28-8523-9ca15e932982NaYaRhttp://social.msdn.microsoft.com/Profile/en-US/?user=NaYaRMake transactiones between tables hi<br/> am making an inventory application with vb.net 2008 and  SQL SERVER 2008 and i have this table of ITEMS and Orders , what i want is when i order a certain quantity , it will automatically be subtracted from the quantity of the item in the items table , ho is that done ?<br/> and how to allow null for certain columns  ?Tue, 10 Nov 2009 21:49:57 Z2009-11-17T08:03:27Z