G
Guest
When I run the following code
public DataView CreateLocationDataSource()
{
string locationConnect = "Provider=\"MSDAORA.1\";" + GetConnectionString() + "";
string locationSelect = "SelectDescription from Locations " +
" where Location = " + "'" + locationLabel.Text.ToUpper() + "'";
oda2 = new OleDbDataAdapter(locationSelect, locationConnect);
DataSet ds2 = new DataSet();
oda2.Fill(ds2, "Locate");
DataView Locate = ds2.Tables["Locate"].DefaultView;
return Locate;
}
public void FillLocation()
{
DataView loc = CreateLocationDataSource();
locDescLabel.Text = loc[0].Row["Description"].ToString();
}
I get the following error:
Index 0 is not non-negative and below total rows count.
Since I am using void why does this happen and how can I cahange my code to prevent it?
Thanks,
Dave
public DataView CreateLocationDataSource()
{
string locationConnect = "Provider=\"MSDAORA.1\";" + GetConnectionString() + "";
string locationSelect = "SelectDescription from Locations " +
" where Location = " + "'" + locationLabel.Text.ToUpper() + "'";
oda2 = new OleDbDataAdapter(locationSelect, locationConnect);
DataSet ds2 = new DataSet();
oda2.Fill(ds2, "Locate");
DataView Locate = ds2.Tables["Locate"].DefaultView;
return Locate;
}
public void FillLocation()
{
DataView loc = CreateLocationDataSource();
locDescLabel.Text = loc[0].Row["Description"].ToString();
}
I get the following error:
Index 0 is not non-negative and below total rows count.
Since I am using void why does this happen and how can I cahange my code to prevent it?
Thanks,
Dave