无法打开与SQL Server的连接。 [英] Could not open Connection to SQL Server.

查看:89
本文介绍了无法打开与SQL Server的连接。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了这个错误。


SQLite错误

接近16:语法错误


代码:

I''m getting this error.

SQLite error
near "16": syntax error

On the code:

展开 | 选择 | Wrap | 行号

推荐答案

您的标题表明您无法打开连接但是您没有提供连接字符串。你在''connString''变量中持有什么?
Your title indicates that you cant open a connection but you didn''t supply your connection string. What are you holding in your ''connString'' variable?


我首先发现了什么错误,我在connString中输错了连接字符串。现在我无法将标题更改为我现在的错误。我已经确定我得到了错误,因为column1的值是:
I found out what was wrong first, I mistyped my connection string in connString. Now I can''t change the title to the error I now have. I''ve constated that I get the error because the value from column1 is:
展开 | 选择 | Wrap | 行号


由于你的方式,这种情况正在发生重新执行更新查询。更好的技术是为命令添加参数并更新参数值。这也更好,因为它消除了任何类型的SQL注入的可能性。
This is happening due to the way you''re performing your update query. A better technique would be to add parameters to your command and update the parameter values. This is also better because it eliminates the possibility of any type of SQL injection.


这篇关于无法打开与SQL Server的连接。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆