Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello

have a program running on local machine in my project. The IP address of a particular locale data to the program I'm running a MySQL dataya want to save. But now I get an error.

"Variables, the acceptable range, or out of the wrong types of arguments used in a conflict with someone else"




VB
Imports MySql.Data.MySqlClient
Public Class Form1
    Public conan As New MySqlConnection
    Public rs As New ADODB.Recordset

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myDB = DBNAME
        Dim myserver = 66.77.144.100 ' IP ADRESS MY MYSQL DATA
        Dim myusername = USer
        Dim mypassword = 12345
        If conan.State = ConnectionState.Closed Then
            conan.ConnectionString = "DATABASE=" & myDB & ";" _ "SERVER=" & myserver & ";user id="& myusername & ";password=" &mypassword
            conan.Open()
        End If
        rs.Open("select * from deneme", conan, 1, 3) 'PROBLEM THIS LINE
End Sub
End Class


VB
[edit]Code block working, "Ignore HTML..." option disabled - OriginalGriff[/edit]
Posted
Updated 8-Mar-11 2:59am
v3
Comments
Wild-Programmer 8-Mar-11 8:54am    
Tried to fix the code formatting but couldn't :(
OriginalGriff 8-Mar-11 9:00am    
You needed to disable the "Ignore HTML..." option, was all!
Wild-Programmer 8-Mar-11 10:06am    
Oh great! thanks for telling :)

1 solution

Is there a reason you are using the ADODB recordset with the MySql database connector? You might have some more luck with the integrated data readers etc built into the MySql connector.

There is a Data Reader that can loop through recordsets similar to opening the recordset that you are doing there just not the same with updating, adding or deleting rows, this is some modified code which might help you get up and running.

VB
Imports MySql.Data.MySqlClient

Public Class Form1
   
    Public conan As New MySqlConnection
    Public dr as MySQLDataReader

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
	Dim myDB = "DBNAME"
        Dim myServer = "66.77.144.100" ' IP ADRESS MY MYSQL DATA
        Dim myUsername = "USer"
        Dim myPassword = "12345"

	Dim connectionString as string, sSQL as string
		
	connectionString = "DATABASE=" & myDB & ";SERVER=" & myServer & ";user id="& myUsername & ";password=" & myPassword

        If conan.State = ConnectionState.Closed Then
            conan.ConnectionString = connectionString
            conan.Open()
        End If

	sSQL = "SELECT * FROM deneme;"

	Cmd = New MySqlCommand(sSQL, conan)
	dr = Cmd.ExecuteReader()

	While dr.Read
	    Response.Write dr("fieldname1")
	End While

	dr.Close()

End Sub
End Class
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900