Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting new record

Status
Not open for further replies.

knaya

MIS
Dec 4, 2003
51
US
This is driving me crazy, someone please help.. i'm trying to insert new records into a table in an access database and what i have done so far is set up a connection using the data link property (oleDB connection), i've set up a oleDB command and on my button (which when users click, it'll insert the record", i have the following code:
With cmdRegister
.Parameters("@email").Value = txtbox1.Text
.Parameters("@password").Value = txtbox2.Text
End With

OleDbConnection1.Open()
cmdRegister.ExecuteNonQuery()
OleDbConnection1.Close()

lblmessage.Text = "Congratulations, you are
now registered"

Now under the properties of my cmdRegister command, i've set up the parameters @email and @password. The part that is driving me crazy is the commandtext, i typed in the following code: INSERT INTO dbo.logininfo (E - Mail, password) VALUES (@ email, @ Password) but it keeps giving me "error in column list '-' not recognized, error in column list'@' not recognized, unable to parse query text.. can someone please tell me what i am doing wrong here, am i typing the command text wrong.. ???? Helpp
 
I just found out password is a reserved word and thus i've changed the command tect to: INSERT INTO dbo.logininfo ([E-Mail], [Password]) VALUES (@emaill, @pword)and now its giving me the error "Error in values list in INSERT INTO clause.Unable to parse query text." arggggggg
 
The OLE DB .Net Provider does not support named parameters. You must use question marks as placeholders for parameters and then add a parameter array to the OleDbCommand object.

stravis
 
stravis,
you are ze best, Its still not working but just the fact that its not giving me those errors anymore is very very pleasing. The problem i'm having now is its telling me the connection failed. I dont know if i did this right but the connection i have(i believe is to a database on my computer).. i have tried using the data link property to connect to an acess database on a server but to no avail. For the connection i use the microsoft jet4.0 OLE DB provider and i enter the path to the database and user, password but then when i try to test the connection, it says "test connection failed becasue of an error in initialing provider.The workgroup information file is missing or oened exclusively by another provider" Do you have any sloutions as to how i can solve this problem. All i'm tryign to do is connect to a database and it's taking forever..

Plus, can you give an example of how this array should look like.. Thanks a lot
 
According to Microsoft's documentation there are two reasons that you could be getting this error code. They are reprinted here for your convenience.

1. The Microsoft® Access database is not a secured database and the login and password specified was not Admin with no password.

2. The Access database is secured and the HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\SystemDB registry key is not pointing to the correct Access workgroup file. Secured Access databases have a corresponding workgroup file, including the full path, which should be indicated by the above registry key.


stravis
 
stravis,
thanks for your help, i finally figured it out. Why in heavens name dont i have access to a SQL server database.. Access sucks.. i can read info. from it but now i cant insert new records etc into the tables.. It keeps saying "System.Data.OleDb.OleDbException: Operation must use an updateable query." and i found out the mdb file has to have full write permissions on it but i'm not sure how that works.. thanks though for your help..
 
No problem. Most of your issues can be resolved with a little help from google.com. I would suggest using this tool first, as you will get a much faster response by searching for your errors there. Always glad to help though.

stravis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top