C#和SQL 2005问题 [英] C# and Sql 2005 problem

查看:64
本文介绍了C#和SQL 2005问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我在C#.net中有一个获胜表格
在这种形式下,有3个文本框...

我想从文本框中插入信息到我的sql express 2005数据库吗?我正在使用WiFi在另一台计算机上与dB进行通信...我与数据库的通信建立了完美的关系...

如何在数据库中插入信息?我需要针对该问题的示例或代码...

谢谢

解决方案

好吧,您需要使用的SQL是Insert
http://www.w3schools.com/sql/sql_insert.asp [ http://forum.codecall. net/c-tutorials/20265-writing-sql-commands-c-part-1-insert-into-table.html [此处 [



试试这个;

SqlCommand insertCommand = new SqlCommand( "INSERT into Wood (city) values (''"+txtwood.text+"'')", connection1);


hi i have a win form in C#.net
in this form there are 3 textbox...

i want to insert informacion from textbox to my sql express 2005 DB? I am using WiFi to comunicate with dB on another computer... my communication with database is establish perfectly...

how do I insert informacion in DB? I need example or code for that problem...

thank you

Ok the SQL you would need to use is Insert
http://www.w3schools.com/sql/sql_insert.asp[^]

You would need to create a SQL Command

http://forum.codecall.net/c-tutorials/20265-writing-sql-commands-c-part-1-insert-into-table.html[^]


If you are looking at information on how to insert records, you could start from here[^].


Seems like you have forgotten a ('') in your query.

SqlCommand insertCommand = new SqlCommand( "INSERT into Wood (city) values (''"+txtwood.text+")", connection1); 



try this;

SqlCommand insertCommand = new SqlCommand( "INSERT into Wood (city) values (''"+txtwood.text+"'')", connection1);


这篇关于C#和SQL 2005问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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