Want to add record into Customer table...

qadeer37

Well-known member
Joined
May 1, 2010
Messages
63
Location
Hyderabad,pakistan
Programming Experience
1-3
Public Sub AddCustomer()

Dim c As Customer
c = New Customer("Tahir", "Khalil", 34)


Dim fn As String = c.FirstName
Dim ln As String = c.LastName
Dim bl As String = CType(c.Balance, String)



Dim Sql As String = String.Format("Insert into Customer (FirstName,LastName,Balance) values('fn','ln','bl');")


MessageBox.Show(Sql)

'Creating Connection

Dim sConnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\QADEER\Documents\Customer.accdb;Persist Security Info=False;"

Dim dbConn As db.OleDb.OleDbConnection = New db.OleDb.OleDbConnection(sConnection)

dbConn.Open()
'Passing Sql Query to Connection.
Dim dbCmd As OleDb.OleDbCommand
dbCmd = New OleDb.OleDbCommand(Sql, dbConn)

dbConn.Close()



End Sub
:mad:
 
Back
Top