The_Fruitman
unread,Jul 3, 2009, 10:15:09 AM7/3/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
"It will be different for each session (to be entered from login
screen) " I would think that the connection string would be different
for each user not each session.
Here's one way I can think of doing this (its early here and I may not
be thinking this through in the best way).
I'm not sure why the VB forms are in different projects, but it
doesn't matter for this. I would recommend creating a DLL (Class
Library project) that both projects would reference. This DLL would
facilitate communication to and from the database as well as any other
code that you tend to use repeatedly (Its nice to have code in one
location if you need to make a change rather than having identical
code in many locations that requires changing). Since most of your
connection string remains the same, have it coded inside the a class
in the DLL project. The DLL Project can have an app config that you
can store configurables such as the IP address or server name and the
database name. Then create a function that builds your connection
string. The username and password variables come from the login
form.
(Note: the following code was typed in here and is most likely missing
some important syntax - I haven't coded in VB for over a year).
Public String CreateConnectionString(UserName as String, Password as
String)
Return Server=(from app.config);Database=(from
app.config);Uid=UserName;Pwd=Password;
End Sub
> > Vineet.- Hide quoted text -
>
> - Show quoted text -