Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27350

Vb.net syntax errors

$
0
0
Hi
I am not sure why I an getting the following error messages, could someone please help me sub one
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Error 2 'connection' is not a member of 'String'. C:\Innoson\Project1.NET\Innoson\Innoson\frmCheckEmployee.vb 19 44
Error 3 Statement is not valid in a namespace. C:\Innoson\Project1.NET\Innoson\Innoson\frmCheckEmployee.vb 35 1
Error 4 Statement is not valid in a namespace. C:\Innoson\Project1.NET\Innoson\Innoson\frmCheckEmployee.vb 40 1
Error 5 Statement is not valid in a namespace. C:\Innoson\Project1.NET\Innoson\Innoson\frmCheckEmployee.vb 44 1
Error 6 Statement is not valid in a namespace. C:\Innoson\Project1.NET\Innoson\Innoson\frmCheckEmployee.vb 49 1
Error 7 Statement is not valid in a namespace. C:\Innoson\Project1.NET\Innoson\Innoson\frmCheckEmployee.vb 53 1
Error 1 Syntax error. C:\Innoson\Project1.NET\Innoson\Innoson\frmCheckEmployee.vb 16 9 Innoson
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HERE ARE MY CODES
Public Class frmCheckEmployee
Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click
Dim lastname As String
'declare variables for database comnection
Dim connectionString As String 'This declares the name of the connection
Dim connection As SqlClient.SqlConnection 'daclares the recordset object
Dim command As SqlClient.SqlCommand ' declares variable to open the recordset
Dim adapter As New SqlClient.SqlDataAdapter
Dim sqlString As String
Dim ds As DataSet
'build SQL String by using the "SqlString" String variable
sqlString = "SELECT*"
'sqlString = sqlString & "From CUSTOMER"
'sqlString = sqlString & "order by CUSTID"
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Innoson\Project1.NET\Innoson\Innoson\Humanresouces.accdb;"
connection = New SqlClient.SqlConnection
connection.Open()
command = New SqlClient.SqlCommand(sqlString.connection)
adapter.SelectCommand = command
ds = New DataSet
adapter.Fill(ds)
'realese Object variables
adapter.Dispose()
command.Dispose()
connection.Close()

End Sub

Private Sub txtLastName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLastName.TextChanged

End Sub
End Class

Viewing all articles
Browse latest Browse all 27350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>