Transfer data from Excel toMySQL database using VB.net

Mar 4 2008 3:45 AM
While importing data from excel to Mysql i found an error. The following code doesnt work. If i execute the statement in command prompt it works. but here in VB.Net it gives an error at 4th line of the below code that object reference not set to an instance of an object.
        con.Open()
        DbCmd = New MySqlCommand("Load data local infile '/" & filename.csv & "'" into table tblname fields Terminated by ',' lines terminated by '\n';", con)
        DbCmd.ExecuteNonQuery()         ' Error occurs here
        con.Close()
Please help.
Thanks