Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Mamatha
Posting Yak Master
102 Posts |
Posted - 2005-10-19 : 14:21:59
|
Hi I am designing a small application with 4 or 5 forms in VB.NET.Now i want to store my data in a database,so i had declared a database connection in a module and try to call that module function from a form.But it gives error when i am declaring con object in a module."Error was con object not declared" but i declared con and imported SQLclient also in that module.Why i got this type of error?How can i declare a database in a module?and how can i call that module from a form?Please give me any solution for this.ThanksMamathaMamatha |
|
Kristen
Test
22859 Posts |
Posted - 2005-10-19 : 14:45:47
|
If you need some guidance on getting your connection string correct have a look here:www.connectionstrings.comotherwise you probably need to post the code you are testing here so that folk can comment on itKristen |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-20 : 02:03:49
|
In VB.NET you can use sqlconnection data from Tool box and connect to SQL ServerThen copy the ConnectionString and use that in your codeMadhivananFailing to plan is Planning to fail |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-10-20 : 08:35:59
|
I know this is a crazy thought, but do you think if you showed us some of your code (your module declaration of the connection, how you initialize it, how you are accessing it) it might be a little bit easier for us to help you? |
 |
|
jhermiz
3564 Posts |
Posted - 2005-10-20 : 10:10:10
|
You can declare the connection string as a constant at the module level.But my suggestion would be to create a db layer class where your string could be encapsulatedinto its own db class. Your forms should only know about creating a database object and calling an open function, the details of how it is done is hidden to other application developers.It's a bit more work, but reusable.Jon Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
 |
|
karuna
Aged Yak Warrior
582 Posts |
Posted - 2005-10-20 : 10:59:52
|
How about storing connection string in the App.Config?ThanksKarunakaran |
 |
|
|
|
|