22,209
社区成员
发帖
与我相关
我的任务
分享
[Microsoft.SqlServer.Server.SqlProcedure]
public static void MyCLR(string airway, string travelline,string humankind,string policyType )
{
using (SqlConnection conn = new SqlConnection(@"server=192.168.1.100\\NEW,1433;uid=sa;pwd=sa;database=MyDB"))
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
cmd.CommandText = string.Format(" select top 1 tax-ceiling(convert(real,qvalue)*convert(real,roe)/10)*10 as tax,0 as qprice from Mytax "
+ "where travelline='{0}' and airway='{1}' and "
+ " humankind='{2}'and created>=dateadd(day,-3,getdate()) order by created desc", airway, travelline, humankind, policyType);
SqlContext.Pipe.ExecuteAndSend(cmd);
conn.Close();
}
}