DLA

Dec 7 2005 10:46 AM
I am writing a code that will bind data to a textbox when a button is click and could not retrive the data from the database and bind it to the textbox  this are my code please tell me where my code is wrong

private void button1_Click(object sender, System.EventArgs e)

{

button1.Focus();try

{

SqlConnection con=new SqlConnection("server=gidafi;uid=sa;pwd=sa;database=pubs");

SqlCommand sqlcom=new SqlCommand("select * from jobs",con);

SqlDataAdapter sqldpt=new SqlDataAdapter();

sqldpt.SelectCommand=sqlcom;

DataSet ds=new DataSet();

con.Open();

sqldpt.Fill(ds,"jobs");

textBox1.DataBindings("Text", ds ,"job_id");

textBox2.DataBindings.Add("Text", ds ,"job_des");

textBox3.DataBindings.Add("Text", ds ,"min_lvl");

textBox4.DataBindings.Add("Text", ds ,"max_lvl");

con.Close();

}

catch(Exception f){MessageBox.Show("what"+f);}
__________________________________________________
I'm using SQL2000 server database

exception generated by the code is WhatSystem.ArgumentException;Cannot bind to property or column job_id Datasource


Answers (1)