Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a table in sqldatabase name records which has 3 columns Id,Name,Address..... i want to fill this table with entries using dataset and dataadapter but dont know how??? plz help me example should be in console app formate...?
Posted

VB
Dim connectionString As String = "Data Source=Machine_Name;Initial Catalog=DB_Name;User ID=;Password="
     Private conn As SqlConnection = New SqlConnection(connectionString)
     conn.Open()

     Dim squery As String
     squery = "select * from tblName where Id=' "  & Id & "' ";
     Dim command As New SqlCommand(squery, conn)
     command.CommandType = CommandType.Text
     Dim data As New SqlDataAdapter(command)
     Dim dsData As New DataSet()
     data.Fill(dsData)
     conn.Close()
 
Share this answer
 
v2
C#
SqlConnection conn=new SqlConnection("Connection string Here");
            conn.Open();
            SqlCommand cmd=new SqlCommand("Command text here",conn);

            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            adapter.Fill(ds);
Try this.....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900