# Re: 下列SQL那里错误

Posted by wave on July 16, 1998 at 10:01:22:

In Reply to: 下列SQL那里错误 posted by jef on July 15, 1998 at 15:38:01:

: Private Sub Command1_Click()
: Dim X, Y, V As Integer
: Dim sSQL As String
: 'Dim dbs As Database
: 'Set dbs = OpenDatabase("c:\s\vbdb.mdb")
: 'sSQL = txtField(0).text
: For X = 0 To 5
: If txtField(X).Text <> " " Then
: sSQL = sSQL + ("学生资料." + txtField(X).Text + ",")
: End If
: Next
: V = Len(sSQL) - 1
: sSQL = Left(sSQL, V)
: SQL = "SELECT 'sSQL' FROM 学生资料"
: 'Set qd = dbs.CreateQueryDef("
: End Sub
...
...
xSQL = ""
For X = 0 To 5
If len(trim(txtField(X).Text)) <> 0 Then
sSQL = sSQL & txtField(X).Text & ","
End If
Next
...
...
SQL = "SELECT " & sSQL & " FROM 学生资料"

Follow Ups: