OleDb Provider installed, but probem still persis
Hi, I have installed a MySQL OleDb Provider after receiving the message " InvalidOperationException: The 'MySQLProv' provider is not registered on the local machine." The version of OleDb Provider that I installed was 3.9.6 -debug. My application was supposed to upload a file to a MySQL database when a button is clicked. I had read in one of the sites that talk about OleDb that one could fix the problem I've experienced by installing an OleDb Provider. That's exactly what I've done and I've also imported everything needed to use OleDb, but I still have the same problem. If you can tell me what else I need to do to resolve this problem I'll be very grateful. Below is my code , thank you in advance for your help.
Imports System.IO
Imports System.Data.OleDb
Public Class Upload
Inherits System.Web.UI.Page
strFileExtension = Right(txtFileContents.PostedFile.FileName, 4)
Select Case strFileExtension.ToLower
Case ".doc"
StrFileType = "doc"
Case ".ppt"
StrFileType = "ppt"
Case ".htm"
StrFileType = "htm"
Case ".html"
StrFileType = "html"
Case ".txt"
StrFileType = "txt"
Case Else
StrFileType = "jpg"
End Select
'Grab the content of uploaded file
intFileLen = txtFileContents.PostedFile.ContentLength
Dim arrFile(intFileLen) As Byte
objStream = txtFileContents.PostedFile.InputStream
objStream.Read(arrFile, 0, intFileLen)
'Add UpLoaded file to a database
myConnection = New OleDbConnection("Provider=MySQLProv; Data Source=Data;User Id=myID;Password=myPWD")
strInsert = "INSERT into QUsers (docTitle,docContent,docDate,docType)values (FileTitle,FileContent,FileType)"
cmdInsert = New OleDbComman(strInsert,myConnection)
cmdInsert.Parameters.Add("@FileTitle", txtFileTitle.Text)
cmdInsert.Parameters.Add("@FileContent", arrFile)
cmdInsert.Parameters.Add("@FileContent", DateTime.Now.ToShortDateString())
cmdInsert.Parameters.Add("@FileType", StrFileType)
cmdInsert.ExecuteNonQuery()
myConnection.Close()
cmdInsert.ExecuteNonQuery()
myConnection.Close()
End If
End Sub
End Class
|