jagpreet 0 Newbie Poster

i have the following code for loading the csv file in to database dynamically.
that is i want to give the file path dynamically .


Dim conn As New MySqlConnection
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim myData As New DataTable

conn = New MySqlConnection()
conn.ConnectionString = "server=localhost " & ";" _
& "user id= root " & ";" _
& "password= cricket" & ";" _
& "database=systemconfiguration"

Dim filePath As String

filePath = Me.filename.Text

conn.Open()


myCommand.Connection = conn

myCommand.CommandText = "load data infile ''?f'' into table configparams columns terminated by ',' enclosed by '""' lines starting by '""'"


myCommand.Parameters.AddWithValue("?f", filePath)

myCommand.ExecuteNonQuery()

this code is giving following error -

error- Parameter '?f''' must be defined.

plz help me out with this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.