RSView32 ODBC Access

dphilps

Member
Join Date
Mar 2010
Location
TN
Posts
6
Can anyone tell me what is wrong with this code!!!
It seems to be hanging-up on the string. I can take the
string commands out and it works fine. Numbers = GOOD and
String or Text = ERROR

Dim objConnection
Dim strConnectionString
Dim strSQL
Dim objCommand
'SQL Table
Dim SQLDate
Dim SQLSFC90deg
Dim SQLSFCoffset
Dim SQLCFCI90deg
Dim SQLCFCIoffset
Dim SQLCFCII90deg
Dim SQLCFCIIoffset
Dim SQLStiffnerWeld
Dim SQLWysong

On Error GoTo ErrorHandler
'On Error Resume Next
gTagDb("PM_Tool\Reset").Value = 1
gTagDb("PM_Tool\RunCmd").Value = 0
strConnectionString = "Provider=MSDASQL;DSN=PM;UID=;PWD=;"
Table = "Tooling"
' report table
SQLDate = "'" & Date & "'"
SQLSFC90deg = gTagDb("PM_Tool\SFC90deg").Value
SQLSFCoffset = gTagDb("PM_Tool\SFCoffset").Value
SQLCFCI90deg = gTagDb("PM_Tool\CFCI90deg").Value
SQLCFCIoffset = gTagDb("PM_Tool\CFCIoffset").Value
SQLCFCII90deg = gTagDb("PM_Tool\CFCII90deg").Value
SQLCFCIIoffset = gTagDb("PM_Tool\CFCIIoffset").Value
SQLStiffnerWeld = gTagDb("PM_Tool\StiffnerWeld").Value
SQLWysong = gTagDb("PM_Tool\Wysong").Value

'strSQL = "INSERT IGNORE INTO " & Table & _
' " (SFC90deg,SFCoffset,CFCI90deg,CFCIoffset,CFCII90deg,CFCIIoffset,StiffnerWeld,Wysong) VALUES (" _
' & SQLSFC90deg & "," & SQLSFCoffset & "," & SQLCFCI90deg & "," & SQLCFCIoffset & "," & SQLCFCII90deg & "," & SQLCFCIIoffset & "," & SQLStiffnerWeld & "," & SQLWysong & ")"

strSQL = "INSERT IGNORE INTO " & HT_Table & _
" (SFC90deg,SFCoffset,CFCI90deg,CFCIoffset,CFCII90deg,CFCIIoffset,StiffnerWeld,Wysong,Date) VALUES (" _
& SQLSFC90deg & "," & SQLSFCoffset & "," & SQLCFCI90deg & "," & SQLCFCIoffset & "," & SQLCFCII90deg & "," & SQLCFCIIoffset & "," & SQLStiffnerWeld & "," & SQLDate & "," & SQLWysong & ")"


Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
With objCommand
.ActiveConnection = objConnection
.CommandText = strSQL
End With
objCommand.Execute
Set objCommand = Nothing
objConnection.Close
Set objConnection = Nothing
gTagDb("PM_Tool\SFC90deg").Value = 0
gTagDb("PM_Tool\SFCoffset").Value = 0
gTagDb("PM_Tool\CFCI90deg").Value = 0
gTagDb("PM_Tool\CFCIoffset").Value = 0
gTagDb("PM_Tool\CFCII90deg").Value = 0
gTagDb("PM_Tool\CFCIIoffset").Value = 0
gTagDb("PM_Tool\StiffnerWeld").Value = 0
gTagDb("PM_Tool\Wysong").Value = 0
Exit Sub
 
You have to delimit strings with the appropriate delimiter, usually an apostrophe.

Code:
INSERT IGNORE INTO Dummy (myNum, myString)
VALUES 123.456,'The Text'

Dates should be in fully expanded, string format as well.
 
OK, here is the "cut-down" version of what is happening. For some reason this code is not working with string data. I have put the apostrophe in and still does not work. Below is the code with the
apostrophe in. I am starting to think it is; well I don't know what i
think now.
Dim objConnection
Dim strConnectionString
Dim strSQL
Dim objCommand
Dim SQLDate
strConnectionString = "Provider=MSDASQL;DSN=test;UID=;PWD=;"
Table = "string"
SQLDate = "'" & "test" & "'"
strSQL = "INSERT IGNORE INTO " & Table & _
" (STR) VALUES (" _
& SQLDate & ")"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
With objCommand
.ActiveConnection = objConnection
.CommandText = strSQL
End With
objCommand.Execute
Set objCommand = Nothing
objConnection.Close
Set objConnection = Nothing
 

Similar Topics

Hi, I have same system connected to 2 PC's running RSView32 SE (old)and another with Factorytalk SE (new). I next few months old one will be...
Replies
2
Views
1,498
Hi, Can I setup RSView32 to log data using ODBC to a table with more than one field? ie Descripton, Operator Name etc. I want to be able to do...
Replies
2
Views
3,006
Hi!! I have MYSQL v5 Serwer on WinXP Pro, with installed MyODBC Driver v3.51.12 and a RsView32.. And I would like to log (by using Datalog)...
Replies
0
Views
4,055
I'm importing an RSView32 project into FTView SE. I'm using Legacy Tag Database Conversion on a virtual machine with Windows XP, I did the first...
Replies
0
Views
367
Hi everybody, I have a rsview32 application, when I try to run it it loads upto 80% system settings and the crashes saying Rsview32 Project...
Replies
3
Views
1,904
Back
Top Bottom