July 5, 2012 at 7:52 am
Now I have got this code in C#.net in my Class library:
[SqlProcedure]
public static void doCostChange(string username, string password, string company, string companypassword)
{
string Uid = "";
try
{
utilitiesclass s = new utilitiesclass();
Uid = s.Logon(username, password, company, companypassword, 0, 0, 0, "");
SqlContext.Pipe.Send(Uid.ToString());
}
catch (Exception ex)
{
SqlContext.Pipe.Send(ex.Message.ToString());
}
SqlCommand cmd = new SqlCommand("getItemsForCostChange");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = conn;
cmd.Parameters.Add(new SqlParameter("@Year", SqlDbType.Int));
cmd.Parameters.Add(new SqlParameter("@Month", SqlDbType.Int));
cmd.Parameters.Add(new SqlParameter("@date", SqlDbType.Date));
cmd.Parameters[0].Value = 2012;
cmd.Parameters[1].Value = 12;
cmd.Parameters[2].Value = "2012-12-02";
SqlDataReader dr;
dr = cmd.ExecuteReader();
Boolean b = dr.Read();
while (b == true)
{
if (dr.GetString(1).Equals("ZK"))
{
CostChange("DK", dr.GetString(0), (double)dr.GetSqlDouble(7),Uid);
}
else
if (dr.GetString(1).Equals("ZW"))
{
CostChange("UK", dr.GetString(0), (double)dr.GetSqlDouble(7),Uid);
}
CostChange(dr.GetString(1), dr.GetString(0), (double)dr.GetSqlDouble(7),Uid);
b = dr.Read();
}
SqlContext.Pipe.Send("fim");
dr.Close();
cmd.Dispose();
}
I have already created assembly and sp in sql server for the fucntion bellow.
I am getting the message:
The settings property 'EngClearing_UtilitiesReference_utilitiesclass' was not found.
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Note that I am invoking a webservice method trougth the utilitiesclass class.
What is hapenig here.
Regards
July 5, 2012 at 8:04 am
Duplicate post. direct all replies here. http://www.sqlservercentral.com/Forums/Topic1325233-392-1.aspx
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply