my code below did not work.
any hints ? Thanks very much.
- Code: Select all
With SalesQuoteObject.Database
rHwnd = .StatementOpen(.ConnectionWrite, , , 0)
sqlInsert = "INSERT INTO key_QO_LineCustomValues (InvoiceHistoryID) "
sqlInsert = sqlInsert & " 'ABCD1234' "
If .ExecuteSQL(CInt(rHwnd), sqlInsert) Then
MsgBox "good"
End If
.StatementClose CInt(rHwnd)
End With
then I tried to use teh folowing and it gives me an overflow error - I suspect the sql user does not let me do inserts, sice if I replace this users with sa it worked.
- Code: Select all
sqlInsert = "INSERT INTO MyTable (InvoiceHistoryID) "
sqlInsert = sqlInsert & " VALUES ('ABCD1234') "
With SalesQuoteObject.Database
MsgBox "server = " & .ServerName & " db = " & .DatabaseName
sCon = "Driver={SQL Server};Server=" & .ServerName & ";Database=" & .DatabaseName & ";UID=" & .SQLLoginName & ";PWD=" & .SQLLoginPassword
MsgBox sCon
cn.Open sCon
cn.Execute sqlInsert
End With
Set cn = nothing