<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: ado code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 18 May 2008 00:30:46 GMT</pubDate>
    <description>DZone Snippets: ado code</description>
    <item>
      <title>Using Rows.Find in ADO.NET</title>
      <link>http://snippets.dzone.com/posts/show/3698</link>
      <description>When using a DataTable in ADO.NET, you may want to search your table given a key. The Find method requires the index of the primary key to find the row that you're looking for. However, before you do this you must set the primary key of the Datatable. Setting the primary key in your database is not enough. To set the primary key, create a new column and then set the primary key field on the Datatable like so:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;// Create the DataColumn list for holding the columns of the primary keys. In this case, we are using only one primary key&lt;br /&gt;DataColumn[] primaryKeyColumns = new DataColumn[1];&lt;br /&gt;&lt;br /&gt;// Set the first primary key to the column 'id' in the datatable&lt;br /&gt;primaryKeyColumns[0] = myDataTable.Columns["id"];&lt;br /&gt;&lt;br /&gt;// Now apply the primary key to the datatable&lt;br /&gt;myDataTable.PrimaryKey = primaryKeyColumns;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 19 Mar 2007 16:01:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3698</guid>
      <author>brainwipe (Rob Lang)</author>
    </item>
    <item>
      <title>RecordSet to tab-separated values</title>
      <link>http://snippets.dzone.com/posts/show/3644</link>
      <description>&lt;code&gt;&lt;br /&gt;Function TSV(rs)&lt;br /&gt;	Dim field&lt;br /&gt;	For Each field In rs.Fields&lt;br /&gt;		TSV = TSV &amp; field.Name &amp; VBTab&lt;br /&gt;	Next&lt;br /&gt;	TSV = Left(TSV, Len(TSV) - 1) &amp; vbCr &amp; rs.GetString()&lt;br /&gt;End Function&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The rows are separated by vbCr ("\r" in most languages).&lt;br /&gt;The first row is the field names.</description>
      <pubDate>Wed, 07 Mar 2007 21:51:49 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3644</guid>
      <author>mrclay (Steve Clay)</author>
    </item>
    <item>
      <title>conectarte a una base de datos con .net</title>
      <link>http://snippets.dzone.com/posts/show/1854</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;SqlConnection conn = null;&lt;br /&gt;SqlCommand cmd = null;&lt;br /&gt;SqlDataReader dr = null;&lt;br /&gt;&lt;br /&gt;String s = null;&lt;br /&gt;Product prod = null;&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;	conn = new SqlConnection("Provider=SQLOLEDB;SERVER=sissql2;UID=sa;PWD=AlfaRoma440;DATABASE=genericatest2");&lt;br /&gt;&lt;br /&gt;	s = " ";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	cmd = new SqlCommand(s,conn);&lt;br /&gt;	dr = cmd.ExecuteReader();&lt;br /&gt;	// lleno el objeto producto&lt;br /&gt;&lt;br /&gt;	while( dr.Read())&lt;br /&gt;	{&lt;br /&gt;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;	// poner el manejo de errores	&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;	dr.Close();&lt;br /&gt;	conn.Close();&lt;br /&gt;}&lt;br /&gt;dr.Close();&lt;br /&gt;conn.Close();&lt;br /&gt;return prod;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 06 Apr 2006 21:44:35 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1854</guid>
      <author>ivan_cursos (Ivan)</author>
    </item>
  </channel>
</rss>
