想问一下这几条语句,怎么改写成c#语句啊?

来源:百度知道 编辑:UC知道 时间:2024/05/14 14:27:07
Function getManagePay(p_team,p_total)
Dim rsmp, msql,xx
xx=0
Dim m_vest
msql = "Select vest From teams Where teamid='"&p_team&"'"
Set rsmp=Server.CreateObject("ADODB.RecordSet")
rsmp.Open msql,Conn,1,1
If Not err And Not rsmp.eof Then
m_vest=rsmp("vest")
If m_vest=1 Then
xx=FourFive2(p_total * 0.01)
Else
xx=FourFive2(p_total * 0.015)
End If
If xx<0 Or isnull(xx)Then xx=0
End If
rsmp.close
set rsmp=nothing
getManagePay=xx
End Function

public int getManagePay(int p_team,int p_total)
{
//string rsmp;
string msql=\"Select vest From teams Where teamid=@p_team\";
int xx=0;
SqlConnection conn=new SqlConnection(msql);
SqlCommand cmd=new SqlCommand(msql,conn);
cmd.Parameters.Add(\"@p_team\",SqlDbType.Int);
cmd.Parameters[\"@p_team\"].Value=p_team;
conn.Open();
int count=cmd.ExecuteNonQuery();
conn.Close();

if(count==1)
{
xx=FourFive2(p_total * 0.01) ;
}
else
{
xx=FourFive2(p_total * 0.015);
}
if(xx<0)
{
xx=0;
}

return xx;

}