VB.Net和数据库连接 [英] VB.Net and Database Connections
问题描述
大家好,
我刚刚开始玩VB.Net。
我当前正在做Powerbuilder的工作并且想知道如何数据库连接
管理在VB.net中运行。
我的应用程序通常会弹出一个登录窗口,尝试连接到
数据库(Sybase或MSSQL)。一旦建立连接,它将打开一个MDI框架,并且应用程序将执行它想做的任何事情。 (主要是通过SQL查询报告
...在PB中有一个叫做数据窗口的东西)
在Powerbuilder中,有一个全局的东西。变量名为SQLCA,它与数据库保持
连接,并且可以从
应用程序中的任何一点访问,因为它具有全局性。
例如,要连接到数据库,我将设置
SQLCA对象的属性,然后发出以下命令:
使用SQLCA连接;
然后无论我在应用程序中的哪个位置,我都可以引用SQLCA对象来获得
a有效的数据库连接。
如何在VB.Net中完成这样的事情。
我设法创建了一个登录窗口。我在OK按钮的
点击事件中有连接逻辑,它确实连接到MS SQLServer 2K。我是否需要
然后将连接对象传递给MDI框架和其他孩子
windows等?
或者是否有更清洁的方法吗?
我不知道宣布全球oledbconnection对象是正确的
要做的事情。
请指教!
谢谢
尼克
共享变量的工作......
Nick N. < NI ************ @ natexisblr.us>在消息中写道
新闻:OG ************** @ TK2MSFTNGP10.phx.gbl ...大家好,
我刚刚开始使用VB.Net。
我当前正在做Powerbuilder的工作,并且想知道数据库连接如何在VB.net中运行。
我的应用程序通常会弹出一个登录窗口,尝试连接到
数据库(Sybase或MSSQL)。建立连接后,
将打开一个MDI框架,应用程序将执行它的任何操作。
(主要由SQL Query报告...在PB中有一些叫做Datawindow的东西)
在Powerbuilder中,有一个全局的东西。变量名为SQLCA,它与数据库保持连接,并且可以从
应用程序中的任何一点访问,因为它具有全局性。
例如,要连接到数据库,我将设置
SQLCA对象的属性,然后发出以下命令:
使用SQLCA连接;
然后无论我在应用程序中,我都可以参考SQLCA对象
用于有效的数据库连接。
如何在VB.Net中完成这样的事情。
我设法创建了一个登录窗口。我在OK按钮的单击事件中有连接逻辑,它确实连接到MS SQLServer 2K。请b $ b我必须将连接对象传递给MDI框架和其他儿童窗口等吗?
或者有更清洁的方法吗?
我不知道是否宣布全球oledbconnection对象是正确的事情。
请指教!
谢谢
Nick
*Nick N. < NI ************ @ natexisblr.us> scripsit:我当前正在做Powerbuilder的工作,并想知道数据库连接管理在VB.net中如何工作。
我的应用程序通常会弹出一个登录窗口,尝试连接到数据库(Sybase或MSSQL)。建立连接后,它将打开一个MDI框架,应用程序将执行任何意图。 (主要是通过SQL Query报告......在PB中有一些叫做Datawindow的东西)
这是一个VB.NET语言组。请注意,如果您将来发布到ADO.NET新闻组,您将有更好的机会获得答案:
< news:// msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>
网络界面:
< http:// msdn .microsoft.com / newsgroups / default.asp?url = / newsgroups / loadframes.asp?icp = msdn& slcid = us& newsgroup = microso ft.public.dotnet.framework.adonet>
-
Herfried K. Wagner [MVP]
< http://www.mvps.org/dotnet>
对不起那个男人。
你的行为就像我踩到了狗屎,走进你的车或什么的。
SENSTIVE
你可以轻松一下吗?
早上带些prozac给我打电话。
我heyt 4kin G33ks谎言你。
" Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道
news:bp ************* @ ID-208219.news.uni-berlin.de ...*Nick N. < NI ************ @ natexisblr.us> scripsit:我当前正在做Powerbuilder的工作,并想知道数据库
连接管理在VB.net中是如何工作的。
我的应用程序通常会弹出一个登录窗口,尝试连接到
数据库(Sybase或MSSQL)。建立连接后,
将打开一个MDI框架,应用程序将执行它的任何操作。
(主要通过SQL Query报告...在PB中有一些叫做Datawindow的东西)
这是一个VB.NET语言组。请注意,如果您将来发布到ADO.NET新闻组,您将有更好的机会获得答案:
< news://msnews.microsoft.com/microsoft。 public.dotnet.framework.adonet>
网页界面:
< http://msdn.microsoft.com/newsgroups...ups/loadframes
..asp?icp = msdn& slcid = us& newsgroup = microsoft.public .dotnet.framework.adonet>
-
Herfried K. Wagner [MVP]
< http://www.mvps.org/dotnet>
Hi all,
I just started to play around with VB.Net.
I currenlty do Powerbuilder work and was wondering how database connection
management works in VB.net.
My applications typically pop-up a login window, attempts to connect to the
database (Sybase or MSSQL). Once the connection is established, it will open
a MDI Frame and the application will do whatever it is meant to do. (Mostly
reporting by SQL Query...in PB there is something called the Datawindow)
In Powerbuilder, there is a "global" variable called SQLCA which holds the
connection to the database and is accessible from any point in the
application given its global nature.
For instance, to connect to the database, I will set properties for the
SQLCA object then issue the following command:
connect using SQLCA;
then wherever I am in the application, I can reference the SQLCA object for
a valid database connection.
How is something like this done in VB.Net.
I managed to create a login window. I have the connection logic in the
clicked event of the OK button and it does connect to MS SQLServer 2K. Do I
have to then Pass the connection object to the MDI frame and other child
windows etc?
Or is there a cleaner way to do this?
I don''t know if declaring a global oledbconnection object is the correct
thing to do.
Please advise!
Thanks
Nick
Shared Variables work...
"Nick N." <ni************@natexisblr.us> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...Hi all,
I just started to play around with VB.Net.
I currenlty do Powerbuilder work and was wondering how database connection
management works in VB.net.
My applications typically pop-up a login window, attempts to connect to the database (Sybase or MSSQL). Once the connection is established, it will open a MDI Frame and the application will do whatever it is meant to do. (Mostly reporting by SQL Query...in PB there is something called the Datawindow)
In Powerbuilder, there is a "global" variable called SQLCA which holds the
connection to the database and is accessible from any point in the
application given its global nature.
For instance, to connect to the database, I will set properties for the
SQLCA object then issue the following command:
connect using SQLCA;
then wherever I am in the application, I can reference the SQLCA object for a valid database connection.
How is something like this done in VB.Net.
I managed to create a login window. I have the connection logic in the
clicked event of the OK button and it does connect to MS SQLServer 2K. Do I have to then Pass the connection object to the MDI frame and other child
windows etc?
Or is there a cleaner way to do this?
I don''t know if declaring a global oledbconnection object is the correct
thing to do.
Please advise!
Thanks
Nick
* "Nick N." <ni************@natexisblr.us> scripsit:I currenlty do Powerbuilder work and was wondering how database connection
management works in VB.net.
My applications typically pop-up a login window, attempts to connect to the
database (Sybase or MSSQL). Once the connection is established, it will open
a MDI Frame and the application will do whatever it is meant to do. (Mostly
reporting by SQL Query...in PB there is something called the Datawindow)
This is a VB.NET language group. Notice that you will have a better
chance to get an answer if you post to the ADO.NET newsgroup in future:
<news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>
Web interface:
<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.adonet>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Excuse me there man.
You act like I stepped on dog crap and stepped into your car or something.
S-E-N-S-T-I-V-E
Take it easy will ya?
Take some prozac and call me in the morning.
I heyt 4kin G33ks liek u.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bp*************@ID-208219.news.uni-berlin.de...* "Nick N." <ni************@natexisblr.us> scripsit:I currenlty do Powerbuilder work and was wondering how database connection management works in VB.net.
My applications typically pop-up a login window, attempts to connect to the database (Sybase or MSSQL). Once the connection is established, it will open a MDI Frame and the application will do whatever it is meant to do. (Mostly reporting by SQL Query...in PB there is something called the Datawindow)
This is a VB.NET language group. Notice that you will have a better
chance to get an answer if you post to the ADO.NET newsgroup in future:
<news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>
Web interface:
<http://msdn.microsoft.com/newsgroups...ups/loadframes
..asp?icp=msdn&slcid=us&newsgroup=microsoft.public .dotnet.framework.adonet>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
这篇关于VB.Net和数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!