且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将数据添加到sql表

更新时间:2023-11-30 23:33:40

以下应该有帮助:
C#Station ADO.NET教程 [为初学者使用ADO.NET [简单的ADO.NET数据库读取,插入,更新和删除使用C#. [ ^ ]
Following should help:
The C# Station ADO.NET Tutorial[^]
Using ADO.NET for beginners[^]
Simple ADO.NET Database Read, Insert, Update and Delete using C#.[^]


从哪里开始?好吧,首先,您不应该使用字符串连接来创建命令.这使您对 SQL注入攻击敞开大门 [ ^ ].

其次,您的字符串连接是错误的-您不应该使用最后一个逗号-看看添加txtCreDate的行(顺便说一句-在这里有了有意义的名称对您来说做得很好-您已经令人惊讶的是人们经常离开默认名称).
Where to begin? Well, first of all, you shouldn''t be using string concatenation to create your command. This leads you wide open to a SQL Injection Attack[^].

Secondly, your string concatenation is wrong - you have a final comma that shouldn''t be there - take a look at the line where you add txtCreDate (BTW - well done to you for having meaningful names here - you''d be surprised how often people leave default names).