首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

VB.NET MYSQL的一个有关问题

2012-03-28 
VB.NET MYSQL的一个问题!Public Sub GridPlay(ByVal strTable As String, ByVal Grid As DataGridView, By

VB.NET MYSQL的一个问题!
Public Sub GridPlay(ByVal strTable As String, ByVal Grid As DataGridView, ByVal strSQL As String)
  Dim dsetDB As DataSet = Nothing
  Dim dapt As SqlDataAdapter = Nothing
  dim strSQL as String="Data Source=192.168.0.231;Initial Catalog=aaa;User ID=root;Password=root"
  Try
  dsetDB = New DataSet(strTable)
  dapt = New SqlDataAdapter(strSQL, strConn)
  dapt.Fill(dsetDB, strTable)

  Grid.DataSource = dsetDB.Tables(0).DefaultView
  Catch ex As Exception
  MsgBox(ex.ToString)
  Finally
  dsetDB.Dispose()
  dapt.Dispose()
  End Try
End Sub

这样会提示错误,root登陆失败要怎么改才行啊!。。。谢谢了。。不知那个连接字符串怎么改!用这个字符串把用户名密码改成sa连MSSQL没问题!我也知道连MYSQL肯定要改但不清楚怎么改!

[解决办法]
Driver=MySQL ODBC 5.1 Driver;Server=192.168.0.231;UID=root;PWD=root;DATABASE=aaa;PORT=3306

[解决办法]
Driver=MySQL ODBC 5.1 Driver;Server=192.168.0.231;UID=root;PWD=root;DATABASE=aaa;PORT=3306

热点排行