troubleshooting Question

Set a string that can be access from the entire winform.

Avatar of SmashAndGrab
SmashAndGrab asked on
C#Microsoft SQL ServerASP
7 Comments1 Solution175 ViewsLast Modified:
Hi Experts,

I have a winform that currently uses MS access as its database.  I am in the process of converting the database to SQL compact.

My current method of accessing the Access database is that I set a string at the beginning of the application and use it throughout the App.

see here:

//set the Connection String at the top of the app so it is accessible throughout the application.

 string conn1 = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:\\Users\\Public\\Documents\\MCRS\\Resources\\DB\\MCRS_Data.mdb";

string conn2 = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:\\Users\\Public\\Documents\\MCRS\\Resources\\DB\\MCRS_OTHER.mdb";

public WhateverTheFunctionIs() {

//call the connection string when accessing the database

   OleDbConnection objConn = new OleDbConnection(conn1 ));[/b]

            OleDbDataAdapter objComm = new OleDbDataAdapter("select Company + ',' + username AS MerchID,FullName, AD_Name from MCRS_LU_Users where active like 'y' and Merchandiser like 'y'", objConn);


Open in new window

My SQL Lite db is within the resources folder.
My Question is this:

How do I do the same with my SQL Compact database?
ol muser
Technology Generalist

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 7 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 7 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004