Click here to Skip to main content
15,909,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i can validate dataset in c# programming language?
Posted
Updated 4-Mar-11 17:34pm
v2

try this code sample
private void Button1_Click( System.object sender, System.EventArgs e)
{
DataSet ds = new DataSet();
string sqlStr;
OleDb.OleDbDataAdapter da;
sqlStr = this.TextBox1.Text.Trim();
da = new OleDb.OleDbDataAdapter(sqlStr, this.ComposerTableAdapter.Connection);
try
{
da.Fill(ds, "TestSQL");
this.c1List1.DataSource = null;
this.c1List1.ClearFields();
this.c1List1.DataSource = ds.Tables("TestSQL");
}
catch( Exception x)
{
MsgBox("Invalid SQL statement.");
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900