 |
|
VB2008 ปัญหาใหญ่หลง ซื่อผมแก้ไม่เป็น เกิดจากอะไร แก้ยังไงครับ มีภาพครับ VB.NET + MySQL |
|
 |
|
|
 |
 |
|
Copy Code มาวางให้ดูหน่อยครับ 
|
 |
 |
 |
 |
Date :
2012-03-15 06:40:45 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (VB.NET)
Imports MySql.Data.MySqlClient
Public Class Form1
Dim MySqlConnection As MySqlConnection
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MySqlConnection = New MySqlConnection()
MySqlConnection.ConnectionString = "server=localhost; user id=root; password=1234; database=1; Pooling=false"
Try
MySqlConnection.Open()
MessageBox.Show("Connection to Database has been opened.")
Catch myerror As MySqlException
MessageBox.Show("Cannot connect to database: " & myerror.Message)
End Try
Dim myadapter As New MySqlDataAdapter
Dim sqlquary = "SELECT * FROM user WHERE username = '" & UsernameTextBox.Text & "' AND password = '" & PasswordTextBox.Text & "';"
Dim command As New MySqlCommand
command.Connection = MySqlConnection
command.CommandText = sqlquary
myadapter.SelectCommand = command
Dim mydata As MySqlDataReader
If mydata.HasRows = 0 Then
MsgBox("ผิดพลาด", MsgBoxStyle.Exclamation)
Else
MsgBox("ถูกต้อง", MsgBoxStyle.Information)
Form2.Show()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|
 |
 |
 |
 |
Date :
2012-03-15 09:25:51 |
By :
pongtanakorn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เงียบ
|
 |
 |
 |
 |
Date :
2012-03-27 20:11:50 |
By :
pongtanakorn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองดูใหม่ครับ
Code (VB.NET)
Imports MySql.Data.MySqlClient
Public Class Form1
Dim MySqlConnection As MySqlConnection
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MySqlConnection = New MySqlConnection()
MySqlConnection.ConnectionString = "server=localhost; user id=root; password=1234; database=1; Pooling=false"
MySqlConnection.Open()
Dim myadapter As New MySqlDataAdapter
Dim sqlquary = "SELECT * FROM user WHERE username = '" & UsernameTextBox.Text & "' AND password = '" & PasswordTextBox.Text & "';"
Dim command As New MySqlCommand
command.Connection = MySqlConnection
command.CommandText = sqlquary
myadapter.SelectCommand = command
Dim mydata As MySqlDataReader
If mydata.HasRows = 0 Then
MsgBox("ผิดพลาด", MsgBoxStyle.Exclamation)
Else
MsgBox("ถูกต้อง", MsgBoxStyle.Information)
Form2.Show()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|
 |
 |
 |
 |
Date :
2012-03-27 20:41:08 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มัน error บอกว่า Unable to connect to any of the specified MySQL hosts. อ่ะครับ
|
 |
 |
 |
 |
Date :
2012-03-27 22:01:02 |
By :
pongtanakorn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่วินครับ คือผมใช้ฐายข้อมูลของ truemoneyhost อ่ะครับ มันจะทำได้มั้ย ถ้าทำได้ ต้องแก้อะไรตรงไหนครับ ? ผู้รู้ช่วยที่ครับ
|
 |
 |
 |
 |
Date :
2012-03-27 22:18:27 |
By :
pongtanakorn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สร้างฐานข้อมูลตัวเองครับ ถ้าเรียกใช้ของที่อื่น ของดูพวก Web Service ครับ
|
 |
 |
 |
 |
Date :
2012-03-28 17:26:23 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมลองแล้วก็เป้นเหมือนเดิมอ่ะครับ 
|
 |
 |
 |
 |
Date :
2012-07-23 22:47:44 |
By :
godskill |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โดยทั่วไป hosting ไม่น่าจะเปิด allow remote connection นะครับ
|
 |
 |
 |
 |
Date :
2012-07-24 08:01:28 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คงจะได้ใช้ Web Service แล้วครับ ตามที่แนะนำเลยครับ
|
 |
 |
 |
 |
Date :
2012-07-24 08:42:39 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|