Retrieve data from Database when I press a button in ASP.Net

Last Reply on Aug 15, 2012 03:55 AM By Mudassar

Posted on Aug 15, 2012 03:54 AM

Hi!

I would like to ask you how can I retrieve data from a database when I press a button?

 

 

'Response.Write "<script type='text/javascript'>"

'Response.Write "$function btClick2(sql)" 

'Response.Write "{"

'Response.Write "String sql = 'SELECT ID,CreateDate, UnitType, StationName FROM MyTable'"

'Response.Write "return sql;"

'Response.Write "}"

'Response.Write "</script>"

 

 

query = btClick2()

 

Response.Write "<Button OnClientClick='btClick2()' Text='Click Me' runat='server' />"

 

This is just the part that is not working and I don't know if is correct!

 

Thanks and have a nice day!