Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
-
StealthRT
- Posts: 12
- Joined: Tue 20 Feb 2007 02:28
Post
by StealthRT » Mon 05 Mar 2007 22:25
Ok im trying here..
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MySQLMobileControl1.SetEncoding(437) '437 = Extended ASCII set: OEM United States
MySQLMobileControl1.SetBufferSize(16 * 1024)
Dim nRet As Integer = MySQLMobileControl1.Connect("xx.xxx.xx.xx", "3306", "User", "Pass")
If nRet = 0 Then
MySQLMobileControl1.SelectDB("databasename")
Else
fnAddMessage(MySQLMobileControl1.GetLastError(nRet))
End If
End Sub
The error i get with the above code is:
Name 'MySQLMobileControl1' is not declared
And for my second question: After it does connect to the mysql database is this how i pull my data from it?
Code: Select all
MySQLMobileControl1.ExecuteQuery("SELECT * FROM citys")
Thanks,
David
-
Alexey
- Posts: 2756
- Joined: Mon 13 Mar 2006 07:43
Post
by Alexey » Tue 06 Mar 2007 09:03
What is 'MySQLMobileControl1'?
-
StealthRT
- Posts: 12
- Joined: Tue 20 Feb 2007 02:28
Post
by StealthRT » Tue 06 Mar 2007 18:31
I took it from the TestAppVB example.
David
-
StealthRT
- Posts: 12
- Joined: Tue 20 Feb 2007 02:28
Post
by StealthRT » Tue 06 Mar 2007 19:38
Ok. maybe i was using the wrong example???
I have switched to this:
Code: Select all
Imports CoreLab.MySql
Public Class Form1
Private connection As MySqlConnection
Private retries As Int32 = 3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
connection.Close()
connection.UserId = "username"
connection.Password = "password"
connection.Host = "x.xxx.xx.xx"
connection.Port = "3306"
connection.Database = "databasename"
connection.Open()
End Sub
However i get an error at the connection.close() saying NullReferenceException was unhandled?
David
-
Alexey
- Posts: 2756
- Joined: Mon 13 Mar 2006 07:43
Post
by Alexey » Wed 07 Mar 2007 07:30
I took it from the TestAppVB example.
I didn't send you this example.
However i get an error at the connection.close() saying NullReferenceException was unhandled?
Where did you take this code? There is no Button1_Click procedure in the samples I've sent you. Please use the project I've sent you.
-
StealthRT
- Posts: 12
- Joined: Tue 20 Feb 2007 02:28
Post
by StealthRT » Wed 07 Mar 2007 17:47
I put the connection inside a button so that it wouldnt load up on the Form_load since i needed to connect to the internet once the emulator started.
The code is from the example you sent to me. Instead of having the textboxes to input the information i've gone ahead and put it in myself:
Code: Select all
Imports CoreLab.MySql
Public Class Form1
Private connection As MySqlConnection
Private retries As Int32 = 3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
connection.Close()
connection.UserId = "username"
connection.Password = "password"
connection.Host = "x.xxx.xx.xx"
connection.Port = "3306"
connection.Database = "databasename"
connection.Open()
End Sub
The orginal code you sent to me looked like this:
Code: Select all
Imports CoreLab.MySql
Public Class ConnectForm
Inherits System.Windows.Forms.Form
Friend WithEvents lbDatabase As System.Windows.Forms.Label
Friend WithEvents lbPort As System.Windows.Forms.Label
Friend WithEvents lbHost As System.Windows.Forms.Label
Friend WithEvents lbPassword As System.Windows.Forms.Label
Friend WithEvents lbUser As System.Windows.Forms.Label
Friend WithEvents tbDatabase As System.Windows.Forms.TextBox
Friend WithEvents tbPort As System.Windows.Forms.TextBox
Friend WithEvents tbHost As System.Windows.Forms.TextBox
Friend WithEvents tbPassword As System.Windows.Forms.TextBox
Friend WithEvents tbUser As System.Windows.Forms.TextBox
Friend WithEvents btCancel As System.Windows.Forms.Button
Friend WithEvents btConnect As System.Windows.Forms.Button
Private connection As MySqlConnection
Private retries As Int32 = 3
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
Public Sub New(ByVal connect As MySqlConnection)
MyBase.New()
InitializeComponent()
Me.connection = connect
Me.tbUser.Text = connect.UserId
Me.tbPassword.Text = connect.Password
Me.tbHost.Text = connect.Host
Me.tbPort.Text = connect.Port.ToString()
Me.tbDatabase.Text = connect.Database
End Sub
Private Sub btConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btConnect.Click
connection.Close()
connection.UserId = tbUser.Text
connection.Password = tbPassword.Text
connection.Host = tbHost.Text
connection.Port = Convert.ToInt32(tbPort.Text)
connection.Database = tbDatabase.Text
connection.Open()
DialogResult = DialogResult.OK
End Sub
David
-
Alexey
- Posts: 2756
- Joined: Mon 13 Mar 2006 07:43
Post
by Alexey » Mon 12 Mar 2007 08:16
Can you sent your sample back to me, so I could reproduce all the problems.