WEB开发网
开发学院数据库MSSQL Server SQL Server中处理单引号的两种技巧 阅读

SQL Server中处理单引号的两种技巧

 2007-12-26 15:29:16 来源:WEB开发网   
核心提示:mycommand.CommandType = adCmdText '表明command 类型Set rstByQuery = New ADODB.RecordsetSet rstByQuery = mycommand.Execute()i = 0Do While Not rstByQuery.EOFi = i

mycommand.CommandType = adCmdText '表明command 类型

Set rstByQuery = New ADODB.Recordset

Set rstByQuery = mycommand.Execute()

i = 0

Do While Not rstByQuery.EOF

i = i + 1 ' i 中保存记录个数

rstByQuery.MoveNext

Loop

MSFlexGrid1.Rows = i + 1 '动态设置MSFlexGrid的行和列

MSFlexGrid1.Cols = rstByQuery.Fields.count + 1

MSFlexGrid1.Row = 0

For i = 0 To rstByQuery.Fields.count - 1

MSFlexGrid1.Col = i + 1

MSFlexGrid1.Text = rstByQuery.Fields.Item(i).Name

Next '设置第一行的标题,用域名填充

i = 0

'Set rstByQuery = mycommand.Execute()

rstByQuery.Requery

Do While Not rstByQuery.EOF

i = i + 1

MSFlexGrid1.Row = i '确定行

For j = 0 To rstByQuery.Fields.count - 1

MSFlexGrid1.Col = j + 1

MSFlexGrid1.Text = rstByQuery(j) '添充所有的列

Next

rstByQuery.MoveNext

Loop '这个循环用来填充MSFlexGrid的内容

End Sub

Private Sub Command2_Click()'参数方法

Dim i As Integer

Dim j As Integer

Set parm = New ADODB.Parameter

Set mycommand = New ADODB.Command

' parm_jobid.Name = "name1" this line can be ommited

parm.Type = adChar '参数类型

parm.Size = 10 '参数长度

parm.Direction = adParamInput '参数方向,输入或输出

parm.Value = Combo1.Text '参数的值

上一页  1 2 3 4  下一页

Tags:SQL Server 处理

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接