<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>p2p.wrox.com Forums - BOOK: Beginning Visual C# 2005</title>
		<link>http://p2p.wrox.com</link>
		<description>This is the forum to discuss the Wrox book Beginning Visual C# 2005 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White; ISBN: 9780764578472 Read more about Beginning Visual C# 2005 or buy the book from your favorite retailer Download the code for Beginning Visual C# 2005</description>
		<language>en</language>
		<lastBuildDate>Sun, 22 Nov 2009 11:27:44 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://p2p.wrox.com/images/misc/rss.jpg</url>
			<title>p2p.wrox.com Forums - BOOK: Beginning Visual C# 2005</title>
			<link>http://p2p.wrox.com</link>
		</image>
		<item>
			<title>c# and SQL query</title>
			<link>http://p2p.wrox.com/book-beginning-visual-c-2005/76916-c-sql-query.html</link>
			<pubDate>Thu, 05 Nov 2009 11:19:23 GMT</pubDate>
			<description>I am working in Asp.net c# platform. I have created a database and now by using c#  I want to insert data through textboxes in the database.  
The...</description>
			<content:encoded><![CDATA[<div>I am working in Asp.net c# platform. I have created a database and now by using c#  I want to insert data through textboxes in the database.  <br />
The code I have written is <br />
<font size="2"><font color="#2b91af"><font size="2"><font color="#2b91af">SqlConnection</font></font></font></font><font size="2"> con = </font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff">new</font></font></font></font><font size="2"><font color="#2b91af"><font size="2"><font color="#2b91af">SqlConnection</font></font></font></font><font size="2">(</font><font size="2"><font color="#a31515"><font size="2"><font color="#a31515">&quot;Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirecto  ry|\\fieldstaff.mdf;Integrated Security=True;User Instance=True&quot;</font></font></font></font><font size="2">);<br />
con.Open();<br />
</font><font size="2"><font color="#2b91af"><font size="2"><font color="#2b91af">DataSet</font></font></font></font><font size="2"> ds = </font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff">new</font></font></font></font><font size="2"><font color="#2b91af"><font size="2"><font color="#2b91af">DataSet</font></font></font></font><font size="2">();<br />
</font><font size="2"><font color="#2b91af"><font size="2"><font color="#2b91af">DataRow</font></font></font></font><font size="2"> dRow = ds.Tables[</font><font size="2"><font color="#a31515"><font size="2"><font color="#a31515">&quot;dairy&quot;</font></font></font></font><font size="2">].NewRow();<br />
dRow[0] = textBox8.Text;<br />
dRow[1] = textBox9.Text;<br />
dRow[2] = textBox10.Text;<br />
dRow[3] = textBox11.Text;<br />
dRow[4] = textBox12.Text;<br />
dRow[5] = textBox13.Text;<br />
dRow[6] = textBox14.Text;<br />
ds.Tables[</font><font size="2"><font color="#a31515"><font size="2"><font color="#a31515">&quot;dairy&quot;</font></font></font></font><font size="2">].Rows.Add(dRow);<br />
</font><font size="2"><font color="#2b91af"><font size="2"><font color="#2b91af">SqlDataAdapter</font></font></font></font><font size="2"> da = </font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff">new</font></font></font></font><font size="2"><font color="#2b91af"><font size="2"><font color="#2b91af">SqlDataAdapter</font></font></font></font><font size="2">();<br />
da.Update(ds,</font><font size="2"><font color="#a31515"><font size="2"><font color="#a31515">&quot;dairy&quot;</font></font></font></font><font size="2">);<br />
</font><font size="2"><font color="#2b91af"><font size="2"><font color="#2b91af">MessageBox</font></font></font></font><font size="2">.Show(</font><font size="2"><font color="#a31515"><font size="2"><font color="#a31515">&quot;1 row is added&quot;</font></font></font></font><font size="2">);<br />
</font><font size="2">con.Close();<br />
 <br />
but I am getting the error &quot;Object reference not set to an instance of an object&quot; at &quot;<font color="#2b91af">DataRow</font><font size="2"> dRow = ds.Tables[</font><font size="2"><font color="#a31515"><font size="2"><font color="#a31515">&quot;dairy&quot;</font></font></font></font><font size="2">].NewRow();&quot; this point. pl. explain me the reason for the same.</font><br />
 <br />
Regards,<br />
</font></div>

]]></content:encoded>
			<category domain="http://p2p.wrox.com/book-beginning-visual-c-2005-222/">BOOK: Beginning Visual C# 2005</category>
			<dc:creator>apurva</dc:creator>
			<guid isPermaLink="true">http://p2p.wrox.com/book-beginning-visual-c-2005/76916-c-sql-query.html</guid>
		</item>
	</channel>
</rss>
