Hi guys: Can any one please help me out in this error? Thanks Error 1 Operator '&' is not defined for types 'String' and 'System.Windows.Forms.TextBox'. C:\Users\kathy\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 20 20 WindowsApplication1
Imports System.Data.OleDb Public Class Form1 Public connection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\kathy\Desktop\generalledger.accdb" Public conn As New OleDbConnection
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
conn.ConnectionString = connection
If conn.State = ConnectionState.Closed Then
conn.Open()
MsgBox("Open")
Else
MsgBox("Closed")
End If
End Sub
Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click
Dim sqlQuery As String
sqlQuery = "insert into voucher(VoucherName, Account_Code, Amount) values ('" & TxtVoucher & "', " & TxtAmount & ", '" & TxtAccount & "')"
Dim sqlcommand As New OleDbCommand
With sqlcommand
.CommandText = sqlQuery
.Connection = conn
.ExecuteNonQuery()
End With
MsgBox("Save")
End Sub
End Class