在VB2008 速成版中使用参数化SQL查询语句无效
最近刚学会在VB2008 中使用参数化SQL语句,于是马上用到代码中,却碰到查不到任何数据的情况,纠结了好几天,还是没有搞明白,差点吐血。不得已还是先在代码中使用字符串拼接的SQL语句。
包含参数化SQL语句的代码如下:
Dim cmSl As New OleDbCommand("select * from PENA where VSL_VOY=@vsl_voy and POD"+ _ "LIKE @pod ",dbCon)
Dim paPOD As New OleDbParameter("@pod", OleDbType.VarChar)
Dim paVSL_VOY As New OleDbParameter("@vsl_voy", OleDbType.VarChar)
paPOD.Value = IIf(Me.TextBoxPOD.Text.Length = 0, "%", Me.TextBoxPOD.Text.Trim.ToUpper)
paVSL_VOY.Value = Me.TextBoxVSL_VOY.Text.Trim.ToUpper
cmSl.Parameters.Add(paVSL_VOY)
cmSl.Parameters.Add(paPOD)
&nbs
相关文档:
Option Explicit
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pDisplayName As String
lpTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Private Declare Function SHGetPathfromIDList Lib "shell32.dll" Alias _
"SHGetPa ......
create table "user" (
id int identity,
constraint PK_USER prim ......
private void Create_Pz(string Sourcename)
{
string OutMsg;
SqlParameter[] sortPara = { new SqlParameter("@ps_IsType", Pz ......
在运行窗口输入regedit,打开注册表编辑器,在HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager中找到PendingFileRenameOperations,删除该键值,关闭注册表编辑器。重新安装SQL Server 2000,此时,就可以正常进入期待的安装界面了。 ......
今天我在SQL Server 2005中用脚本创建一张表,查资料发现有的脚本中字段有加[]中符号,我问了冬季,得知是这回事,用[]的字段名,即便是sql关键字也可以作为字段名,不会报错。
SQL Server里的表中添加一个字段,如:time系统会自动加一对方括号即:[time] ......