|
-
Feb 23rd, 2013, 10:00 AM
#1
Thread Starter
New Member
[RESOLVED] i have error saving in database
hello guys,
please help me to fix my problem.. i am trying to add record in my database in mysql.. i have this codes below:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
rs = New ADODB.Recordset
rs.Open("insert into employee values('" & txtid.Text & "','" & txtname.Text & "','" & txtaddress.Text & "','" & cmbgender.Text & "','" & DateTimePicker1. Text & "')", Mycon, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
MsgBox("save agad")
End Sub
when i run it an error shows like this:
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147217887
Message="ODBC driver does not support the requested properties."
Source="Microsoft OLE DB Provider for ODBC Drivers"
i don't know how to solve this because i used this code already in other project and it worked..
is anyone know how to solve this??
help. . . .
-
Feb 23rd, 2013, 02:57 PM
#2
Re: i have error saving in database
Sounds like you are using the wrong connection string.
Also you should be using ADO.Net rather than ADODB
-
Feb 23rd, 2013, 04:27 PM
#3
Re: i have error saving in database
 Originally Posted by DataMiser
Sounds like you are using the wrong connection string.
Also you should be using ADO.Net rather than ADODB
as DataMiser said, use ADO.Net instead of the superceded ADODB
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 23rd, 2013, 06:49 PM
#4
Re: i have error saving in database
The best answer is certainly to get away from ADODB in favor of the newer, but if that is in someway impractical, then you're going to have to do a bit of detective work. Database errors like this can be rather opaque in that the error message doesn't really tell you what the problem is in a very specific sense. Something isn't supported, maybe, but what? Is it just a typo, or is one of your arguments wrong? You don't get much information about that.
Unfortunately for you, since ADODB is so dated, few people will have much experience with it in .NET. But you DO have some experience with it, since, according to you, this code worked in a different program. So, what is different between the two? Because that's where your problem lies. Are both programs on the same computer (and if not, is one on a 64-bit while the other is not)? Are you using the same arguments? Something has to be different or else both would behave the same.
My usual boring signature: Nothing
 
-
Feb 23rd, 2013, 07:11 PM
#5
Thread Starter
New Member
Re: i have error saving in database
i am currently using it here in my laptop means that this is not different bits (32 bit/64 bit) the first program i used is work, it is about adding and generating serialcode in database.. what i was edited here is only the names of table and columns.
anyway, how can i change it into ado.net connection?
thanks guys for reading my post.. thanks for helping also.. i am a new member here and a new student in vb.net
-
Feb 23rd, 2013, 09:02 PM
#6
Re: i have error saving in database
Instead of using the OLE DB driver he should be using a MySql driver. I would think that is the most likely candidate.
From a connection string I have used to connect to MySql using ADODB from Vb6
DRIVER={MySQL ODBC 3.51 Driver}
-
Feb 24th, 2013, 04:52 AM
#7
Lively Member
Re: i have error saving in database
And whatever you do, beware of SQL Injection. The user could type in all sorts of nasty things in the text boxes that would end up as SQL commands. Use parameters instead.
-
Feb 24th, 2013, 06:17 AM
#8
Thread Starter
New Member
Re: i have error saving in database
guys, do i have to use the ado.net connection?
what line in my code should i change if i revise it into ado.net?
thanks..
-
Feb 24th, 2013, 11:09 AM
#9
Re: i have error saving in database
You would change all of the lines related to database access.
-
Feb 24th, 2013, 12:18 PM
#10
Re: i have error saving in database
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 25th, 2013, 11:07 PM
#11
Thread Starter
New Member
Re: i have error saving in database
guys i found the already the error.. it works now i just edit the connection string.. thanks for those who response to my post..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|