exceptions plz solve in c#
this is my code: plz help error: not a valid file name public partial class fwnote : Form { public fwnote() { InitializeComponent(); } OleDbConnection con = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = DataDirectory\\E:\\parceldb.mdb"); // "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +sourceFile + ";Extended Properties=\"Excel 8.0;HDR=NO;\""; private void button1_Click(object sender, EventArgs e) { string str = "select * from train_details where place = Delhi"; OleDbCommand cmd = new OleDbCommand(str, con); con.Open(); OleDbDataReader dr = cmd.ExecuteReader(); if (dr.Read() == true) { MessageBox.Show(dr.GetValue(2).ToString()); } //MessageBox.Show("tn"); con.Close(); } } }
Subramanyam RompicherlaPosted Jun 29, 2009, 7:59 AM
i hope error in sql statement please check the below statement
string str = "select * from train_details where place = '"+Delhi+"'";
because, string not allow without single cote in sql statement. if you are not solved please let me know