|
-
Jan 29th, 2007, 04:45 PM
#1
Thread Starter
Lively Member
[RESOLVED] Variable Help...
maybe i have done something wrong here...
can someone please give me a little direction...
Please review code below:
SqlCommand cmd = new SqlCommand("GetPublisherID", conn);
cmd.Parameters.Add("@PublisherName", SqlDbType.VarChar);
cmd.Parameters["@PublisherName"].Value = PublisherName;
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = cmd;
DataSet ds = new DataSet();
try
{
adapter.Fill(ds);
}
catch
{
MessageBox.Show("Dataset did not get filled");
}
DataView dv = new DataView();
dv = ds.Tables[0].DefaultView;
this.txtSearchName.DataBindings.Clear();
this.txtSearchName.DataBindings.Add("text", dv, ("Publisher_ID"));
I am trying to pull a variable out of my sql database. i know the dataview and dataset gets populated because the above text box gets populated.
I have a string variable that i am trying to set. I have used a datarow, datatable, dataview, and dataset. I always get an error saying there is no row at position 0.
help help...
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|