保存并从SQL检索数据而无需定义连接字符串 [英] Save & Retrieve data from SQL without define connection string

查看:87
本文介绍了保存并从SQL检索数据而无需定义连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好..朋友在vb.net中是可能的,我们可以保存sql或从中检索数据,而无需在单个表中定义连接字符串(如果可以的话),然后告诉我如何做,请您的帮助.

在此先感谢

Parveen Rathi

Hi.. friends is that possible in vb.net that we can save or retrieve data from sql without define the connection string only in single table if it is possible then tell me how, please I need the help of you.

Thanks in advance

Parveen Rathi

推荐答案

否.不可能.如果不使用连接字符串,您的程序将无法识别服务器,数据库,表.

如果不想在web.config文件中定义连接字符串,则可以直接在SqlConnection对象中使用连接字符串.
No. Not possible. Without using connection string your program will not identify the server, database, table.

If you don''t want to define the connection string in web.config file, you can directly use the connection string in the SqlConnection object.
Dim sqlCon as New SqlConnection("server='servername';Initial Catalog='databasename';user id='username';password='password'")


您可以广播UDP请求并在运行时从服务器获取您的连接字符串,从而避免了需要客户端连接字符串.
You can broadcast a UDP request and get back your connection string from a server at runtime, circumventing the need for a client side connection string.


这篇关于保存并从SQL检索数据而无需定义连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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