如何在C#中更改它 [英] How can change it in C#

查看:56
本文介绍了如何在C#中更改它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub AddStocksInUpdating()
        If txtItemNo.Text = "" Then
            MsgBox("Please select item to add stocks.", MsgBoxStyle.Critical, "Select Item")
            Exit Sub
        End If
        Dim strStocksIn As String

        strStocksIn = InputBox("Enter number of items : ", "Stocks In")
        txtQuantity.Text = Val(txtQuantity.Text) + Val(strStocksIn)
        Try
            sqL = "INSERT INTO StocksIn(ItemNo, ItemQuantity, SIDate, CurrentStocks) VALUES('" & txtItemNo.Text & "', '" & strStocksIn & "', '" & Format(Date.Now, "Short Date") & "', " & txtQuantity.Text & ")"
            ConnDB()
            cmd = New OleDbCommand(sqL, conn)
            Dim i As Integer

            i = cmd.ExecuteNonQuery()
            If i > 0 Then
                MsgBox("Stocks added successfully", MsgBoxStyle.Information, "Stocks In")
                Updateproduct()
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            cmd.Dispose()
            conn.Close()
        End Try
    End Sub

推荐答案

试试这个网站

将VB.NET转换为C# [ ^ ]



try this site
Convert VB.NET to C#[^]

private void AddStocksInUpdating()
{
	if (string.IsNullOrEmpty(txtItemNo.Text)) {
		Interaction.MsgBox("Please select item to add stocks.", MsgBoxStyle.Critical, "Select Item");
		return;
	}
	string strStocksIn = null;

	strStocksIn = Interaction.InputBox("Enter number of items : ", "Stocks In");
	txtQuantity.Text = Conversion.Val(txtQuantity.Text) + Conversion.Val(strStocksIn);
	try {
		System.Data.sqL = "INSERT INTO StocksIn(ItemNo, ItemQuantity, SIDate, CurrentStocks) VALUES('" + txtItemNo.Text + "', '" + strStocksIn + "', '" + Strings.Format(System.DateTime.Now, "Short Date") + "', " + txtQuantity.Text + ")";
		ConnDB();
		cmd = new OleDbCommand(System.Data.sqL, conn);
		int i = 0;

		i = cmd.ExecuteNonQuery();
		if (i > 0) {
			Interaction.MsgBox("Stocks added successfully", MsgBoxStyle.Information, "Stocks In");
			Updateproduct();
		}
	} catch (Exception ex) {
		Interaction.MsgBox(ex.Message);
	} finally {
		cmd.Dispose();
		conn.Close();
	}
}


这篇关于如何在C#中更改它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆