in database TID is number , and typename is text...prgram should read the textbox1's value and then search for that TID in database ..and according to that tid will read typename... this is the relation..
whenever i try to read a number it happens specially in autonumbers if any one have any tutorial then plz paste a link... thanx....

private void button1_Click_1(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;Data source=data.mdb");
try
{
conn.Open();
}
catch (OleDbException ex)
{
Console.WriteLine("ERROR: {0}", ex.Message);
}
string str = "select TypeName from CandieType where TID='" + textBox1.Text + "'";
OleDbCommand command = new OleDbCommand(str, conn);
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
textBox3.Text = reader["TypeName"].ToString();
}
reader.Close();
try
{
conn.Close();
}
catch (OleDbException ex)
{
Console.WriteLine("ERROR: {0}", ex.Message);
}
}

New Topic/Question
Reply




MultiQuote





|