易截截图软件、单文件、免安装、纯绿色、仅160KB

C# 更新access问题!大侠请进

1.这样可以:
command.CommandText = @"Update college Set name='mick' where ID=" + textBox3.Text;

2.这样却不行:
command.CommandText = @"Update college Set name=" + textBox1.Text + @"where ID=" + textBox3.Text;
错误信息:
未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 System.Data.dll 中。
其他信息: 语法错误 (操作符丢失) 在查询表达式 'mickwhere ID=1' 中。

3.这样仍然不行:(where前面加了个空格)
command.CommandText = @"Update college Set name= " + textBox1.Text + @" where ID=" + textBox3.Text;
错误信息:
未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 System.Data.dll 中。
其他信息: 至少一个参数没有被指定值。

请问应如何处理?
急 多谢!!!!

2.这样却不行:
command.CommandText = @"Update college Set name=" + textBox1.Text + @"where ID=" + textBox3.Text;
错误信息:
未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 System.Data.dll 中。
其他信息: 语法错误 (操作符丢失) 在查询表达式 'mickwhere ID=1' 中。


说的很清楚了, 语法错误    name='" + textBox1.Text + "' where ID="  where前面加空格,text内容用引号


试试楼上的方法,把单引号包含在字符串里面。

textBox1.Text 字符串前后加 单引号:

command.CommandText = @"U


相关问答:

C#asp.net生成 Excel的问题

网上看了很多,好像这样调用很好:Excel.Application();
但是需要引入什么命名空间或者dll才能运行Excel这个类呢?

Excel.dll

Excel.dll在Excel安装程序下,
using Microsoft.Office.Interop.Excel;
......

C#如何判断连接sql server数据库成功?

C#如何判断连接sql server数据库成功?
try
{
connection.connect()
return true;
}
catch()
{
return false;
}

楼主很着急,开了几贴了。

引用
try
{
connection.connect( ......

access 查询记录的问题?

问题如下:

用查询语句
select * from tab where fil like 'CK090902'能查找出一条记录并显示出来
改为
select * from tab where fil = 'CK090902'
就不能查找到,也显示不出来 ......

access不能修改内容

如题在我打开access修改的时候报错
我装的Ghost 的XP版 sp3的补丁
错误签名
AppName: msaccess.exe      AppVer: 11.0.8166.0    AppStamp:46437912
ModName: pintlgnt.ime&n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号