1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19:
Dim cn As New SqlConnection(My.Settings.Conn_DB) cn.Open() Dim SqlAttr As New SqlDataAdapter Dim ds As New DataSet Dim sqlcmd As New SqlCommand With sqlcmd .Connection = cn .CommandType = CommandType.StoredProcedure .CommandText = sql End With SqlAttr.SelectCommand = sqlcmd Dim DtAttr As DataTable = ds.Tables.Add("Attributes") 'Fill the Schema SqlAttr.FillSchema(DtAttr, SchemaType.Mapped)
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
Dim cn As New SqlConnection(My.Settings.Conn_DB) cn.Open() 'DataAdapter will open the connection so this is not needed. Dim SqlAttr As New SqlDataAdapter Dim ds As New DataSet Dim sqlcmd As New SqlCommand With sqlcmd .Connection = cn .CommandType = CommandType.StoredProcedure .CommandText = sql End With SqlAttr.SelectCommand = sqlcmd SqlAttr.Fill(ds)