Advanced VB.Net

Moderators: None (Apply to moderate this forum)
Number of threads: 260
Number of posts: 394

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Problem in finding path of the connection in MS Access. Posted by cshankar on 28 Apr 2009 at 9:30 AM
pleased help me,I am new in vb.net programming. I have written codes for connection with MS ACCESS and I have created rooms.mdb database and I stored inside the bin directory but database is not found error is coming.

Imports System.Data.OleDb
Public Class NewUserScreen

Dim objOLEDBCon As OleDbConnection
Dim strInsertCommand As String
Dim objCmd As OleDbCommand

Private Sub btnAccept_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAccept.Click


objOLEDBCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\bin\rooms.mdb")
strInsertCommand = "insert into Users(Name, Password, Phone) values('" & txtUserName.Text & "','" & txtPassword.Text & "'," & txtPhone.Text & ")"
objCmd = New OleDbCommand(strInsertCommand, objOLEDBCon)
objOLEDBCon.Open()
Dim i As Integer
i = objCmd.ExecuteNonQuery
If (i > 0) Then
MsgBox("Your Data Inserted Successfully!")

End If
objOLEDBCon.Close()

End Sub


End Class
Attachment: Room Bookings System.zip (326560 Bytes | downloaded 84 times)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.