主页面和SQL连接 [英] Master page and sql connection

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

问题描述





我已经根据母版页创建了母版页和子页面。



我可以通过default.aspx连接到sql server或者说使用母版页创建的first.aspx页面。



是否可以在母版页中使用sqlconnection对象并在default.aspx页面或其他子页面中使用它来连接到sql server。我试过这个但是没有工作..



它只在我将连接对象放在单独的页面中时才有效..



希望我清楚我的查询声明...



Thnx

Hi,

I have created master page and sub pages based on master page..

I am able to connect to sql server by default.aspx or say first.aspx page created using Master page.

Is it possible to have sqlconnection objects in Master page and use it in default.aspx pages or other sub pages to connect to sql server. I have tried this but not working..

It is working only if I put connection objects in individual pages..

hope I am clear with statement of my query...

Thnx

推荐答案

您可以在Web.config中提供连接字符串,并且可以在页面中使用该连接。
you can give connection string in Web.config and you can use that connection in pages.


这篇关于主页面和SQL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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