Home > Software engineering >  Invalid column name repeated the experiment with no solution
Invalid column name repeated the experiment with no solution

Time:10-04

When debugging repeatedly hint column "C" invalid
SQL="update tb_TLlist set Tqty= c ='" where Tno & amp; Text3. Text & amp; "'
"If change the C to a value, such as 20:
SQL="update tb_TLlist set Tqty= 20 where Tno='" & amp; Text3. Text & amp; "'
"You can change the database

SQL2008 database, Tqty int
In VB, C integer

What is wrong? Specific coding is as follows:
I also tried the FLEXGRID change fields for C, no problems

Private Sub Command3_Click ()
Dim rs1 As New ADODB. You
Dim rs2 As New ADODB. You
Dim command As New ADODB.com mand

Dim As SQL String
Dim As a Integer
Dim As Integer b
Dim As Integer c

Rs1. Open "tb_TLlist", CNN, adOpenStatic, adCmdTable
Rs2. Open the "select * from tb_TLlist where Tno='" & amp; Text3. Text & amp; "'", CNN, adOpenKeyset, adLockOptimistic

A=Val (Text4. Text)
B=rs2. Fields (" Tqty ")
c=Int (b - a)

If c & lt; 0 Then
MsgBox "? A '? 2? X? On??????? D? E? E?"
Text4. Text=""
Text4. SetFocus
The Else
Label5. Caption="????? A '?? 1 od "& amp; C
MS1. TextMatrix (MS1. Row, 2)=c
="SQL update tb_TLlist set where Tno Tqty=c='" & amp; Text3. Text & amp; "'"
The Set command. The ActiveConnection=CNN
Command.Com mandText=SQL
Command. The Execute
End the If

Rs1. Close
Rs2. Close

End Sub

CodePudding user response:

SQL="update tb_TLlist set Tqty= "& amp; C & amp;" ='" where Tno & amp; Text3. Text & amp; "'"

CodePudding user response:

Tqty is digital, how to give it the letter,

CodePudding user response:

C is a variable, not a field name:
SQL="update tb_TLlist set Tqty=" & amp; C & amp;" Where Tno='" & amp; Text3. Text & amp; "'"

CodePudding user response:

SQL="update table name set character field='" & amp; Character variables & amp;" 'where character field=' "& amp; Character variables & amp;" '
"SQL="update table name set numeric field=" & amp; Numeric variables & amp;" Where the numeric field="& amp; Numeric variables & amp;" "

CodePudding user response:

reference 1st floor bakw response:
="SQL update tb_TLlist set Tqty= "& amp; C & amp;" ='" where Tno & amp; Text3. Text & amp; "'"

agree

CodePudding user response:

Thank you for your reply, don't know why the old account can't log in, can only register a new,
Don't know how to send points to help a friend?
Is cry?

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- rookie of amateurs

CodePudding user response:

refer to 6th floor thirdtimenow response:
thank you for your reply, don't know why the old account can't log in, can only register a new,
Don't know how to send points to help a friend?
Is cry?

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- a rookie in the rookie

If registered mail before, you can try to retrieve password or something.
  • Related