How to retrieve data from sqlserver
How to retrieve data from sqlserver . if i save 5000 in sqlserver then i have to add the value which i give in textbox in asp.net using c#.that 5000 should not be shown in running time.,
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Keyur Narkhi62 reputationPosted Apr 30, 2012, 12:17 AM EDT
Below is the code for getting time.
protected void Page_Load(object sender, EventArgs e)
{
string connection1 = "connectionstring";
SqlConnection connection = new SqlConnection(connection1);
connection.Open();
SqlDataReader myReader = null;
SqlCommand myCommand = new SqlCommand("SELECT CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond", connection);
myCommand.Connection = connection;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
txt1.Text = myReader["HourMinuteSecond"].ToString();
}
}
Hope this helps
thanks
Jignesh TrivediRank #16 · 50.3K reputationPosted May 27, 2012, 8:02 PM EDT
Can you please provide more information?
I didn't get question, what actually you want.
thx.