sql server - How to get rid of this error: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;' -
the purpose of application when user types in customer, username , message respective textboxes, it's supposed recorded table on sql server after user presses send button.
here's code:
public class form1 dim con oledbconnection dim cmd new oledbcommand dim constring string = "data source=176.111.555.24;initial catalog=mydatabase;user id=username;password=password" public sub messagesent() try dim con new oledbconnection con.connectionstring = constring con.open() cmd.connection = con cmd.commandtext = "insert tblmessage(customer, username, message) values('" & txtcustomer.text & "', '" & txtusername.text & "', '" & rtfmessage.text & "')" cmd.executenonquery() con.close() msgbox("message sent") con.close() con.dispose() catch ex exception msgbox(ex.message) end try end sub private sub btnsend_click(sender object, e eventargs) handles btnsend.click messagesent() end sub
i'm getting following error:
an ole db provider not specified in connectionstring. example be, 'provider=sqloledb;'.
what i'm doing wrong , how can resolved.
it looks trying give sql server connection string oledbconnection
. need either use sqlconnection
open connection string or else need create valid oledb connection string point database. reference, see this site.
Comments
Post a Comment