Can we bind datareader to textboxes?
-
I found out we could bind datareader to grid, dropdown list etc. but can we bind datareader to textboxes? if it is possible how to do it?
-
I found out we could bind datareader to grid, dropdown list etc. but can we bind datareader to textboxes? if it is possible how to do it?
-
I found out we could bind datareader to grid, dropdown list etc. but can we bind datareader to textboxes? if it is possible how to do it?
hi, yes you can bind textboxes to a datareader. A textbox can be bounded with one record of a datareader object like that.....
//make connection,command object then.... Connection.Open(); reader=SqlCommand.ExecuteReader(); reader.Read(); TextBox1.Text =reader.GetString(1);
Tirtha Live life to the fullest -
i dont think so you can bind to textbox. you can set the value from reader to textbox. Nav.
-
hi nav, yes you are partially right. actually the problem arises when the datareader has null values.Isnt it? Other wise do u think that the following code is incorrect.
txtName.text=reader("Name")
whats ur opinion? Tirtha Live life to the fullest -
completley agree with you its ok if we not getting any null values. and we can set a check for null as wel. but if we look at the question its not binding its jus a way to getting and setting a value to textbox. regards Nav.
-
hi nav, Ok Ok.agree with u. now its settled. Tirtha :laugh::laugh::laugh:The best prophet of the future is the past Live life to the fullest