can anyone help me,i have placed 2textboxes and a button,one textbox is to give the name ,textbox2 is to retrive values from db(address of a paricular name ),i tried a lot ,but i couldn't make it,help pleaz.......... ........
c#.net:retriving data from db to textboxes
Collapse
X
-
Could you please post the relevant code here.
And please use code tags while posting your code.
Regards
Dheeraj Joshi -
I'm sure you understand that to put text in a textbox you just set the textbox.text property.
So I assume the real crux of the problem is in working with a database, right?
Database tutorial Part 1
Database tutorial Part 2Comment
-
I don't understand what your table looks like. If you are running 3 queries, each returning 1 value which you want to use as the value of your textbox, use ExecuteScalar method of the SqlCommand object.
and then set your values for your textboxes like this:
TextBox2.Text = (string)YourSql CommandObject.E xecuteScalar();
otherwise you will set TextBox.Text equal to whatever construct you have populated from the database (Datatable, array, etcetera).Comment
Comment