Hi I want to Clarify what is the Problem of this code?
if you feel free to answer Thanks alot...

Private Sub addakoordr_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles addakoordr.Click

    Dim tr As String = tID.Text
    Dim qo As String = tquanOrder.Text
    Dim arw As String = cdateselec.Text
    cname.Enabled = False
    cdateselec.Enabled = False
    tpronem.Enabled = True
    tproclas.Enabled = True
    tprice.Enabled = True
    txtcateg.Enabled = True
    tquanOrder.Enabled = True
    tstock.Enabled = False
    tamount.Enabled = True

    If cname.Text = "" Then
        addakoordr.Enabled = False
        cname.Focus()
    End If

    If Val(tquanOrder.Text) > Val(tstock.Text) Then
        MsgBox("Ang nilagay ninyo po ay sobra hindi siya nagtugma", MsgBoxStyle.Information)
        tquanOrder.Text = ""
        tquanOrder.Focus()
    ElseIf Val(tquanOrder.Text) = 0 Then
        MsgBox("Invalid Input", MsgBoxStyle.Exclamation)
        tquanOrder.Text = ""
        tquanOrder.Focus()
    ElseIf Val(tstock.Text) = 0 Then
        MsgBox("Stock is not Available Please choose other Item", MsgBoxStyle.Information)
        tquanOrder.Text = ""
        tquanOrder.Focus()

    Else
        Dim utosako As OleDbCommand = New OleDbCommand
        Dim sampque As String
        Dim puno As OleDbDataAdapter = New OleDbDataAdapter

        dbcon.ConnectionString = db
        dbcon.Open()

        sampque = "INSERT INTO orders ([transactionumber],Quantityordr,orderdate,amtordr) VALUES ('" & tr & "', '" & qo & "', '" & arw & "','" & tamount.Text & "' )"

        utosako.Connection = dbcon
        utosako.CommandText = sampque

        puno.SelectCommand = utosako
        puno.Fill(ds, "orders")     '<--- I have an error here and the title is the description 

        ds.AcceptChanges()


        Dim dared As OleDbDataReader
        dared = utosako.ExecuteReader
        dared.Read()

        survill()

    End If


    dbcon.Close()


    dbcon.Open()
    Dim i As Integer
    i = DataGridView1.CurrentRow.Index
    dbcon.ConnectionString = db
    Dim bawas As Integer
    bawas = Val(tstock.Text) - Val(tquanOrder.Text)
    tstock.Text = bawas.ToString

    ds.Tables("orders").Rows(i).Item(2) = bawas

    da.Update(ds, "orders")
    MsgBox("ordered added")
        dbcon.Close()


    dbcon.Close()




End Sub

I look the other article about this but none is similar from my error

Cheers all Programmers

Recommended Answers

All 3 Replies

Problems:

  1. No comments
  2. No description of any kind as to what you want to do
  3. Incomplete error message
  4. No posting of the value of sampque
commented: Yup +0

Sir Sorry for bad descriptions... I didn't put any comments but I already solved my problem... because of the Wrong Spelling of Tablename in SQL Statement

anyway Thank you for replying

First Rule of Programming/Debugging ...
Use try catch statements ^_^

do it like this ...

Private Sub addakoordr_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles addakoordr.Click
    Try
        'Your very long code here
    Catch ex as Exception
        MsgBox("An unexpected error occured: " & ex.Message)
    End Try
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.