coletteck8
asked on
fill a datagrid with a datatable
i am fairly new to .net and need to know hot to call the function below and fill a datagrid with it. any help?
Friend Function GetPermitList() As System.Data.DataTable
Dim cn As SqlConnection = Me.CreateConnection()
Dim cmd As New SqlCommand("spPermit", cn)
Dim dt As New DataTable
With cmd
.CommandType = CommandType.StoredProcedur e
.Parameters.Add("@PermitId ", SqlDbType.Int).Value = 0
.Parameters.Add("@Mode", SqlDbType.VarChar).Value = "SELECT"
End With
cn.Open()
Dim da As New SqlDataAdapter(cmd)
da.Fill(dt)
cn.Close()
Return dt
End Function
Friend Function GetPermitList() As System.Data.DataTable
Dim cn As SqlConnection = Me.CreateConnection()
Dim cmd As New SqlCommand("spPermit", cn)
Dim dt As New DataTable
With cmd
.CommandType = CommandType.StoredProcedur
.Parameters.Add("@PermitId
.Parameters.Add("@Mode", SqlDbType.VarChar).Value = "SELECT"
End With
cn.Open()
Dim da As New SqlDataAdapter(cmd)
da.Fill(dt)
cn.Close()
Return dt
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks so much. it worked perfectly
yourdatagrid.datasource = getpermitlist()
yourdatagrid.DataBind()
-Baan