| Author: Anil Kumar Pandey 26 Sep 2008 | Member Level: Diamond | Rating:  Points: 5 |
hi,
please refer the following code..
Dim con As New SqlConnection(conString) Dim cmd As SqlCommand Dim query As String
query = "SELECT Proj_ID, Proj_Name FROM Projects" Dim da As New SqlDataAdapter(query, con) Dim ds As New DataSet
da.Fill(ds, "Projects") da.Dispose()
Textbox1.Text = ds.Tables[0].Rows[0]["Proj_Name"].Tostring(); Textbox2.Text = ds.Tables[0].Rows[0]["Proj_Id"].Tostring();
Regards Anil
Thanks & Regards Anil Kumar Pandey
|
| Author: Avadhesh Kumar Tiwari 26 Sep 2008 | Member Level: Silver | Rating:  Points: 5 |
try
using System.data.SqlClient;
sqlconnection con; sqlcommand com; sqldataadapter da dataset ds;
at Form_Load event
{
con=new sqlconnection("Data Source=servername;Initial Catalog=db_name;User ID=sa;Password=sa"); com=new sqlcommand("Select emp_name from Employee",con); da=new sqldataadapter(com); da.fill(ds);
texBox.Text=ds.tables[0].Rows[0][0].ToString();
hope it will help You.....
You can contact me personally in avadhesh_fetcse@yahoomail.com or directally call me @ +919019548045
|