SELECT * from Vehicle where regn = [@regn]
SELECT * from Vehicle where regn = ?
//Get your connection string here string ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["YourConnectionString"].ConnectionString; //Create your query here string SqlString = "SELECT * from Vehicle where regn = ?"; //Initialize the connection using (OleDbConnection conn = new OleDbConnection(ConnString)) { //Initialize the command using (OleDbCommand cmd = new OleDbCommand(SqlString, conn)) { cmd.CommandType = CommandType.Text; //Pass the parameter cmd.Parameters.AddWithValue("regn", txtregn.Text); conn.Open(); using (OleDbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { //Read your values here } } } }
Thanks, A2H My Blog
Login to post response