|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Retrieval of data from mulit table from SQL server and load into datagrid
Originally posted by : blueei (blueei@hotmail.com)hilo, i'm a newbie at VB.NET... and i've wrote in VB.NET i've been trying examples from reference books and online reference... but it seems that i either got the syntax wrong or just could not get it right, i think that i have something somewhere wrong with the Join table part. as i have to use 3 different tables to get the result. anyone, pls help out... thank you! veri veri much! my syntax are as follows... '''''''''''''''''''''''''''''''''''''''''''''''''' Dim objDataSet As New DataSet("ValidReasonList") Dim cnn As SqlConnection Dim cmd As SqlDataAdapter Dim sql As String Dim tblValidReasons As New DataTable("ValidReasons") cnn = New SqlConnection("server=(local); database=sas2000; Integrated Security=SSPI") sql = "SELECT A.APPROVED, B.ADMNO, B.DATEFROM, B.DATETO, B.REASON_DESC, C.REASONTYPE_NAME" sql = sql & "FROM ABSENCE A, ABS_REASON B, ABS_REASON_TYPE C" sql = sql & "WHERE A.REASON_ID = B.REASON_ID AND B.REASONTYPE_ID = C.REASONTYPE_ID" sql = sql & "ORDER BY B.ADMNO" cmd = New SqlDataAdapter(sql, cnn) cmd.Fill(objDataSet, "JoinTable") dgValidReasons.DataSource = objDataSet.Tables("JoinTable").DefaultView dgValidReasons.DataBind() ''''''''''''''''''''''''''''''''''''''''''''''''''
|
|
#2
|
|||
|
|||
|
Originally posted by : duno (duno@hotmail.com)------------blueei at 12/6/2001 8:36:37 PMhilo, i'm a newbie at VB.NET... and i've wrote in VB.NET i've been trying examples from reference books and online reference... but it seems that i either got the syntax wrong or just could not get it right, i think that i have something somewhere wrong with the Join table part. as i have to use 3 different tables to get the result. anyone, pls help out... thank you! veri veri much! my syntax are as follows... '''''''''''''''''''''''''''''''''''''''''''''''''' Dim objDataSet As New DataSet("ValidReasonList") Dim cnn As SqlConnection Dim cmd As SqlDataAdapter Dim sql As String Dim tblValidReasons As New DataTable("ValidReasons") cnn = New SqlConnection("server=(local); database=sas2000; Integrated Security=SSPI") sql = "SELECT A.APPROVED, B.ADMNO, B.DATEFROM, B.DATETO, B.REASON_DESC, C.REASONTYPE_NAME" sql = sql & "FROM ABSENCE A, ABS_REASON B, ABS_REASON_TYPE C" sql = sql & "WHERE A.REASON_ID = B.REASON_ID AND B.REASONTYPE_ID = C.REASONTYPE_ID" sql = sql & "ORDER BY B.ADMNO" cmd = New SqlDataAdapter(sql, cnn) cmd.Fill(objDataSet, "JoinTable") dgValidReasons.DataSource = objDataSet.Tables("JoinTable").DefaultView dgValidReasons.DataBind() '''''''''''''''''''''''''''''''''''''''''''''''''' must have been the sql statement...
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Retrieval of data from mulit table from SQL server and load into datagrid |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|