I want to change the code from using Access to SQL server 2000, what do i have to change in the next sentence:
dim Conn as new OleDbConnection("Provider=" & "Microsoft.Jet.OLEDB.4.0;" & _
"Data Source =D:\f\o\forfera\private\R.mdb")
dim objCmd as OleDbCommand = new OleDbCommand ("ValidateUser", Conn)
objCmd.CommandType = CommandType.StoredProcedure
Do i have to change another things in my code, like importing any namespace?
Thank'sSkip the OleDb Namespace and exchange it with the SqlClient Namespace. As for your code:
Dim Conn as New OleDbConnection("Server=<yoursqlserver>;uid=<username>;pwd<secret>;database=<yourdatabasename>")
Dim objCmd as New SqlCommand("ValidateUser", Conn)
objCmd.CommandType = CommandType.StoredProcedure
Remember also to change your eventual OleDbType to SqlDbType when using parameters. In short, whereever you use OleDb, use Sql instead.|||I know Andre has answered this question already,
and I'd like to share a tool with all of you. :)
FYI:http://weblogs.asp.net/coltk/archive/2004/05/31/144810.aspx
Regards, Colt|||Hi
Thank's for the answer, dont i have to write the source of the data base(location)?
Thank's|||The source of your database is your SQL Server. If the SQL Server is installed on your local development machine, your server is 'localhost' or '<machinename>'. If you are connecting to a remote machine, use the IP no, or Url of the Sql Server machine.
No comments:
Post a Comment