0

how can i get a value from my database table and display in a textbox or in the label...

using c#(window application and web application)

kindly guide me

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by sharath61
0

There's more than one way to do it, and there are questions that have to be answered first. What kind of database is it? Do you already have a connection? Are you running a stored procedure or an ad hoc query? Does the query need any input? Are you doing any other work? The process may need to be run as a transaction.

And more importantly, what have you tried already that didn't work?

0

this is wat i av done...

what i need is...

i want my username and the region to be fetched from the table and display in every page..
i have done this in web application...

hope tht u can get me de code..

i have done this with MY-SQL
con=new SqlConnection("server=pstlcorpserv;database=mis;user Id=sa;password=sqlserver12#");
con.Open();
adap = new SqlDataAdapter("select region from users where username like @r", con);
set = new DataSet();
adap.SelectCommand.Parameters.Add("@r", SqlDbType.VarChar);
adap.SelectCommand.Parameters[0].Value = Label2.Text+"%";
adap.Fill(set);
set.Tables.Add("users");
adap.Fill(set, "users").ToString();
Label2.Text = set.Tables[0].Columns.ToString();
con.Close();

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.