this is vb6 newsgroup.
AGP
"Mac" wrote in message
> I am using VB.NET.
>
> I just created a form where user enters information. Once information is
> entered, user clicks ok button.
>
> While updating the table, I am getting an error and it does not update. I
> am using 2 tables, INVSHIP and PARTSQTY. Both have comon column called
> part. Once it matches, I want to grab the quantity from PARTSQTY table.
>
>
> I would appreciate if someone please help.
>
> Here is my coding:
>
>
>
> Dim cn As ADODB.Connection
>
> Dim rs As ADODB.Recordset
>
> Dim strsql As String
>
> Dim sqlsvrstr As String
>
> Dim strcnn As String
>
> 'Dim userpassstr As String
>
> Dim sqldbstr As String
>
> Dim mcust As String
>
> Dim mpallet As String
>
> Dim mpart As String
>
> Dim TEST As String
>
>
>
>
>
> '
>
> sqlsvrstr = "30.0.1.2"
>
> sqldbstr = "m2mdata01"
>
> strcnn = "driver=sql server; server=" & sqlsvrstr & ";" & _
>
> "uid=sa;pwd=just4admin;database=" & sqldbstr & ";"
>
> '
>
> cn = New ADODB.Connection
>
> '
>
> rs = New ADODB.Recordset
>
> rs.CursorType = ADODB.CursorTypeEnum.adOpenKeyset
>
> rs.LockType = ADODB.LockTypeEnum.adLockOptimistic
>
> '
>
> TEST = MsgBox(Me.txtcust.Text)
>
>
>
>
>
> mcust = Me.txtcust.Text
>
> mpallet = Me.txtpallet.Text
>
> mpart = Me.txtpart.Text
>
> strsql = "update invship set invship.customer='" & mcust & " ', " & _
>
> "invship.pallet = '" & mpallet & " ', invship.part = '" & mpart & "', " &
_
>
> "invship.qty = partsqty.qty from invship inner join " & _
>
> "partsqty on invship.part = partsqty.part "
>
> cn.Open(strcnn)
>
> rs.Open(strsql, cn)
>
> cn.Execute(strsql)
>
> rs.Close()
>
> cn.Close()
>
> End Sub
>
> End Class
>
>
>> Stay informed about: Can someone please help me to fix an error ?