我如何更改但发生许多错误的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

不是C#,而是VB.
它不会编译为C#,甚至不会编译.
但是...您可以通过以下方式运行它: http://www.developerfusion.com/tools/convert/vb-to-csharp/ [ ^ ]-这是一个在线代码转换器,大部分情况下都做得很好...
That isn''t C# - it VB.
It won''t compile as C#, or even close.
But...you could run it through this: http://www.developerfusion.com/tools/convert/vb-to-csharp/[^] - it''s an online code translater that mostly does a pretty good job...