请给出ASP代码 [英] Please give the code of ASP

查看:63
本文介绍了请给出ASP代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用ASP.net和C#创建一个简单的项目
我想连接数据库.如何在asp.net中执行此操作.如果使用sqlconnection,则会发生错误.哪个命名空间将给出

请任何人都可以为这个问题提供帮助

谢谢

I want to create a simple project with ASP.net and C#
I want to connect the database. how to do it in asp.net.The error will occured give the sqlconnection. which namespace will given

Please anyone can help for this problem

Thank you

推荐答案



使用此命名空间:
Hi,

Use this namespace :
using System.Data.SqlClient;



声明sql连接类:



declare sql connection class:

SqlConnection Con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["testConnectionString"].ToString());
Con.Open();



将其放在web.config文件中,并根据您的sql server数据源名称,初始目录,用户ID和密码设置四个参数.



put this one on web.config file and set four parameters as per your sql server Data Source name, Initial Catalog, User ID and Password.

<connectionStrings>
  <add name="testConnectionString" connectionString="Data Source=;Initial Catalog=;User ID=;Password=;
   providerName="System.Data.SqlClient" />
 </connectionStrings>


请参考一些pdf,以了解有关asp.net的更多信息,在此名称空间下,我们在后面的代码中使用它来进行连接...通过教程pdf

please refer some pdf to learn more about asp.net, this namespace below which we use in code behind to connect...go thru tutorial pdf

using System.Data.SqlClient;

..




跟随这一面学习asp.net和ado.net.

http://www.csharp-station.com/Tutorial.aspx [ http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson01.aspx [ ^ ]

我认为这对您有帮助.........
Hi,

Follow this side to learn asp.net and ado.net.

http://www.csharp-station.com/Tutorial.aspx[^]
http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson01.aspx[^]

i think this is help to you............


这篇关于请给出ASP代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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