I'm not using VS.NET's Server Explorer. Below is a copy of my code, I
replaced my sa password with password for this post (for security purposes).
The code works when I change Server=(db) to Server=(local), db is the remote
server. My local license database is a copy of db license database.
The error occurs at oCn.Open(), the error message is "
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or access
denied.
at System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
isInTransaction )
at
System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString options, Boolean& isInTransaction )
at System.Data.Sql Client.SqlConne ction.Open() …………… ………"
string sConnString = "Server=(db);Da tabase=License; Integrated
Security=False; User ID=sa;password= password";
string sProc = "prGet_DealerIn fo";
using (SqlConnection oCn = new
SqlConnection(s ConnString))
{
using (SqlCommand oCmd = new
SqlCommand(sPro c, oCn))
{
oCn.Open();
oCmd.CommandTyp e =
CommandType.Sto redProcedure;
oCmd.Parameters .Add("@sDealerN um", SqlDbType.NChar , 6);
oCmd.Parameters["@sDealerNu m"].Value = txtDealerNum.Te xt;
oCmd.Parameters .Add("@sSaleID" , SqlDbType.Int, 10);
oCmd.Parameters["@sSaleID"].Direction = ParameterDirect ion.Output;
oCmd.Parameters .Add("@sSiteNam e", SqlDbType.NVarC har, 40);
oCmd.Parameters["@sSiteName "].Direction = ParameterDirect ion.Output;
oCmd.Parameters .Add("@sName", SqlDbType.NVarC har, 40);
oCmd.Parameters["@sName"].Direction = ParameterDirect ion.Output;
oCmd.Parameters .Add("@sAmount" , SqlDbType.Decim al, 10);
oCmd.Parameters["@sAmount"].Direction = ParameterDirect ion.Output;
oCmd.ExecuteNon Query();
oCn.Close();
string sSaleID =
oCmd.Parameters["@sSaleID"].Value.ToString ();
string sSiteName =
oCmd.Parameters["@sSiteName "].Value.ToString ();
string sName =
oCmd.Parameters["@sName"].Value.ToString ();
string sAmount =
oCmd.Parameters["@sAmount"].Value.ToString ();
}
}
Also, I checked ODBC connections and added db to User DSN, System DSN and
File DSN but still get same error when I run the code.
"Kevin Yu [MSFT]" wrote:
Hi,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you're trying to connect to a remote
SQL server using VS.NET's Server Explorer. But cannot open and edit the
stored procedure on remote server. If there is any misunderstandin g, please
feel free to let me know.
Here, I suggest you try the following:
1. Create a new data connection in Server Explorer using sa account.
2. Connect to the data source and open an SP.
If you cannot open the SP, is there any error messages? Also, can you open
a table?
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."