Introduction:
This article is helps to how to get values from database in dataset formats using asp.net. Here I explain some data should be insert into a particular tables. After we get a data from dataset formats using dataadapter.
VB.NET:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Handles Me.Load
Dim con As New SqlConnection("server=192.168.1.100;uid=sa;pwd=sa123;
database=asp_dotnet")
database=asp_dotnet")
con.Open()
Dim cmd As New SqlCommand("SELECT * FROM STUDENTDETAILS ; SELECT * FROM STUDENTMARKDETAILS", con)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
da.Fill(dt)
con.Close()
End Sub
C#.NET:
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = newSqlConnection("server=192.168.1.100;uid=sa;pwd=sa123;database=asp_dotnet");
con.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM STUDENTDETAILS ; SELECT * FROM STUDENTMARKDETAILS", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
con.Close();
}
Demo:
0 comments:
Post a Comment