Dear All
I wrote a code to save a data using text box but there are some error like : ArguimentException was unhandled. Cannot bind to the property or column User Privilege on the DataSource.Parameter name: dataMember
My code for saving is :
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim Con As OleDb.OleDbConnection
Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Pfectrol\My Documents\Visual Studio 2008\db\CoolMate.mdb;"
Try
Dim strSQL As String = "INSERT INTO Equipment (Port_Number,Display_Name, Equipment, Tonnage,User_Privilage) VALUES (@Port_Number, Display_Name, @Equipment, @Tonnage, @User_Privilage);"
Dim cmd As New OleDb.OleDbCommand(strSQL)
Con = New OleDb.OleDbConnection(strConnection)
cmd.Connection = Con
Con.Open()
cmd.ExecuteNonQuery()
Con.Close()
Catch ex As Exception
Trace.WriteLine(ex.ToString)
End Try
cmd.Dispose()
cmd = Nothing
End Sub
and used module for connection and its code is like
Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management.Common
Imports System.ArgumentException
Module ModCool
Public Function Chiller() As OleDb.OleDbConnection
Dim Con As OleDb.OleDbConnection
Con = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\Pfectrol\My Documents\Visual Studio 2008\db\CoolMate.mdb;")
Return Con
Con = Nothing
End Function
Public bool As Boolean
Public da As OleDb.OleDbDataAdapter
Public dtable As New DataTable
Public i As Int16
Public cmd As OleDb.OleDbCommand
Public da1 As OleDb.OleDbDataAdapter
Public strSQL As String
Public CB As OleDb.OleDbCommandBuilder
Public con = ModCool.Chiller
End Module
Any one can Help me Please its really hurry