Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

Simple Mysql Help Needed

$
0
0
Hey guys, This is my first post to these forums. I've just recently started playing around with visual basic and used to be pretty familiar with it quite a few years ago. I still remember bits and pieces but I'm quite rusty. The problem I'm having right now is "object reference not set... " here is my code:

Public Sub DoLogin()
Dim ds1 As DataSet = New DataSet
Dim da1 As MySqlDataAdapter = New MySqlDataAdapter
da1.SelectCommand.Connection = New MySqlConnection("server=localhost; user id=root; password=; database=dhe") *******This is the line that throws the exception
da1.SelectCommand = New MySqlCommand("SELECT * FROM emp_db")
da1.Fill(ds1, "emp_db")
FrmMain.Show()
FrmMain.DataGridView1.DataSource = ds1
FrmMain.DataGridView1.DataMember = "emp_db"
End Sub


I'm just trying to connect to a mysql database and fill a dataset then display the table in a datagridview. Any Help would be greatly appreciated!!

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>