Sorry the previous code I sent contained invalid paramenters name, here is
the syntaxlycorrected code:
public string GetOneParameterFromSP(string Param1,string Param1Value,string
Param2,string Param2Value, string SPname)
{
string strConnectionString;
// strConnectionString="data source=192.168.0192.168.0.5.5;initial
catalog=ComStore;password=t211;persist security info=True;user id=sa;workstation
id=INSPIRON-2650;packet size=4096";
strConnectionString="data source=localhost;initial
catalog=ComStore;password=t211;persist security info=True;user id=sa;workstation
id=INSPIRON-2650;packet size=4096";
SqlConnection conConnect2SQL = new SqlConnection(strConnectionString);
conConnect2SQL.Open();
SqlCommand comCheckLogedIn = new SqlCommand();
comCheckLogedIn.Connection = conConnect2SQL;
comCheckLogedIn.CommandType = CommandType.StoredProcedure;
comCheckLogedIn.CommandText = SPname;
comCheckLogedIn.Parameters.Add(Param1, SqlDbType.VarChar, 30);
comCheckLogedIn.Parameters[Param1].Direction = ParameterDirection.Input;
comCheckLogedIn.Parameters[Param1].Value=Param1Value;
comCheckLogedIn.Parameters.Add(Param2, SqlDbType.VarChar, 30);
comCheckLogedIn.Parameters[Param2].Direction = ParameterDirection.Input;
comCheckLogedIn.Parameters[Param2].Value=Param2Value;
string outParam = "@outUserID";
comCheckLogedIn.Parameters.Add(outParam, SqlDbType.VarChar, 30);
comCheckLogedIn.Parameters["@outUserID"].Direction =
ParameterDirection.Output;
conConnect2SQL.Open();
string outParamValue;
outParamValue = comCheckLogedIn.Parameters["@outUserID"].Value.ToString();
return outParamValue.ToString();
}
Let me know how it goes !
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/saFolB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/