>Hi,
>
>I am trying to connect to a local SQL Server on the Network using the
>following code in Beta2(System.Data.SqlClient).
>
>#####
>
> string sConn = "User ID=sa;Pwd=;Database=lib;Server=rukku;Integrated
>Security=false";
>
> string sCommand = "SELECT max(book_id)from book_details";
> SqlCommand myCommand = new SqlCommand(sCommand);
> myCommand.Connection = new SqlConnection(sConn);
> myCommand.Connection.Open();
>
>#####
>
>But I am getting a SecurityException.
>
>Do I need to setup special permission on the SQL Server before executing
>these statements, because I am getting some Permission problems.The error is occurring at the Open() statement. Can anyone help !
>
>
>Regds,
>Mahabeer
This has been known to be fun! Not really, but here are a few ideas.
Since you are using ODBC here is some code I use for that purpose:
strConn = "Driver={SQL SERVER};SERVER=T22VSQ02;DATABASE=QMDS;UID=QMDSWebUser;PWD=WebUser;"
If SQL Server is on the same machine as is being used for development things normally work well. When you run the data from a different server things do get interesting.
If you have not done so try the following:
1. Right Click on the database ICON from the Enterprise Manager in SQL Server. Go to Permission and define public roles as required
3. Be sure you are set up with your user security with a public entry.
Tom
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement