C#初级问题
1.我定义了一个string类型的数组(strArray),并已成功赋值
int p_lnno;
float p_tsqty;
p_lnno = strArray[0]; --不能隐式转换从string到int
p_tsqty = (float)strArray[2]; --不能从string转换到float
我该怎么做转换才能得到数字类型的p_lnno和p_tsqty?
2.在一个BUTTON的CLICK时间中定义(已引入system.data.sqlclient):
private void Btn_Upload_Click(object sender, EventArgs e)
{
.....
SqlCommand Mycommand = new SqlCommand();
MyCommand.CommandText = "Insert into Cs_InterTb values(1,2,3)";
.....
}
为什么编译的时候还是说Mycommand在上下文中找不到?