Visual Studio 2008插入SQL DB [英] Visual Studio 2008 Insert Into SQL DB

查看:83
本文介绍了Visual Studio 2008插入SQL DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个简单的示例,说明如何从VB.net将带有文本"字段的记录插入到SQL Server 2008数据库表中.
请注意,我是在专门谈论文本"数据类型,而不是一般的字符串(例如,不是"varchar").

I need a simple example of how to insert a record with a "text" field into a SQL Server 2008 database table from VB.net.

Note that I am talking about the "text" data type specifically, not strings in general (e.g., not "varchar").

推荐答案

SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=testdb;Integrated Security=True");
conn.Open();
string Insquery = "INSERT INTO userinfo values(''"+TextBox1.text+"'')"
SqlCommand cmd = new SqlCommand(Insquery,conn);
cmd.ExecuteNonQuery();

Response.Write("Inserted");

conn.Close();



希望以上信息对您有所帮助.如果您还有其他疑问,请告诉我.



I hope the above information will be helpful. If you have more concerns, please let me know.


外观

您可以在You tube上查询.

www.asp.net
a look

you can query this on You tube.

and www.asp.net


以下是google [此处找到所需的内容. /ado/sqlserver1.aspx"target =" _ blank"title ="新窗口> ^ ]

问候
Espen Harlinn
Here is a few answers from google[^]

You''ll find what you need here[^]

Regards
Espen Harlinn


这篇关于Visual Studio 2008插入SQL DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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