您好,我在将 vb 转换为 c sharp 时遇到问题
Dim Query As String = "UPDATE F_Shqip SET Lika_Sh=@Fjalet_Sh WHERE Id_Sh=@Id_Sh"
Dim cmd As SqlCommand = New SqlCommand(Query, con)
cmd.Parameters.AddWithValue("@Lika_Sh", Trim(Me.txbLikaSh.Text))
cmd.Parameters.AddWithValue("@Id_Sh", Me.ListBox1.SelectedItem(0).ToString)
在升c中:
string Query = "UPDATE F_Shqip SET Lika_Sh=@Lika_Sh WHERE Id_Sh=@Id_Sh";
SqlCommand cmd = new SqlCommand(Query, con);
//two lines with errors
cmd.Parameters.AddWithValue("@Lika_Sh", Strings.Trim(this.txbLikaSh.Text));
cmd.Parameters.AddWithValue("@Id_Sh", this.ListBox1.SelectedItem(0).ToString);