C
campbellbrian2001
Thanks all in advance. A couple of questions: I was trying to set up a
form with a datagrid to display . I have a successful attachment to an
Access Database (Northwind).
The code below failed. I had copied it as a lab exercise
(I get the following error message: "An unhandled exception of type
'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.")
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "procFranceCustomers"
Dim da As SqlDataAdapter = New SqlDataAdapter
da.SelectCommand = cmd
Dim ds As DataSet = New DataSet
da.Fill(ds, "Customers")
dgresults.DataSource = ds
dgresults.DataMember = "Customers"
End Sub
End Class
Also why does the IDE prevent me from placing Parenthecals "()" ?
Line should read Dim ds As DataSet = New DataSet()
Line should read Dim da As SqlDataAdapter = New SqlDataAdapter()
form with a datagrid to display . I have a successful attachment to an
Access Database (Northwind).
The code below failed. I had copied it as a lab exercise
(I get the following error message: "An unhandled exception of type
'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.")
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "procFranceCustomers"
Dim da As SqlDataAdapter = New SqlDataAdapter
da.SelectCommand = cmd
Dim ds As DataSet = New DataSet
da.Fill(ds, "Customers")
dgresults.DataSource = ds
dgresults.DataMember = "Customers"
End Sub
End Class
Also why does the IDE prevent me from placing Parenthecals "()" ?
Line should read Dim ds As DataSet = New DataSet()
Line should read Dim da As SqlDataAdapter = New SqlDataAdapter()