Try adding an App.Config file to your project. Then add a key to the App.Config. in that key specify the connection string. That way when you publish your project all you have to edit is the App.Config file in order to change DBs.
|
|
guys, i am a newbie at vb.net i am using vb.net 2008, now
i am having a big probLem about my Win-base appLication, i am trying to pubLish my project / make it an ".exe = executable" file, it is connected to an ACCESS DATABASE. The problem is that, after getting my application to a ".exe" form, it seems that the application recognize stiLL the original database, where is my path --> OleDb.OleDbConnection("Provider=Microsoft.ACE.oled b.12.0;Data source=C:\Users\x3r0\Desktop\vb_skuL\prog_sad_3_te st\products.accdb") <-- of the originaL database, when i try to input at the ".exe" file, the data are going to the originaL database, and when i tried to change the path, coz i am thinking of using another database, error says cannot find "C:\Users\x3r0\Desktop\vb_skuL\prog_sad_3_test\pro ducts.accdb"... before changing the databse, ofcourse i have changed that path already for my new database, but it shows an error for the database its using before.. guys,, heLp me.. T_T
Try adding an App.Config file to your project. Then add a key to the App.Config. in that key specify the connection string. That way when you publish your project all you have to edit is the App.Config file in order to change DBs.
--Insert Clever Signature--
paste your app config please, so we can see it![]()
If I solve your issue or you are happy with my response, please provide me with reputation by clicking the reputation link at the top right of my posts - thanks
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="dadz_2.My.MySettings.productsConnectionStrin g" connectionString="Provider=Microsoft.ACE.OLEDB.12. 0;Data Source=C:\Users\x3r0\Desktop\testing\prog_sad_3_te st\products.accdb"
providerName="System.Data.OleDb" />
<add name="dadz_2.My.MySettings.regConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12. 0;Data Source=|DataDirectory|\reg.accdb"
providerName="System.Data.OleDb" />
<add name="dadz_2.My.MySettings.Database1ConnectionStri ng" connectionString="Data Source=|DataDirectory|\Database1.sdf"
providerName="Microsoft.SqlServerCe.Client.3.5" />
</connectionStrings>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceLi stener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
</configuration>
-----------> sir, anyway,, my probLem was soLved regarding the path of database, i have just made it run just now, thanks for your heLp.. now another probLem is that, when i pubLish the Program to make it ".exe" at the foLder where i pubLish it, the database are not there, is that normaL? or the database must aLso be at the Location where i pubLished my project..? how about if i Let another user at another PC, to use the ".exe" fiLe of my program? how wouLd the program recognize its database? or it will look for the location of the database itseLf?
i have just noticed at the error List beLow the window of VB.NET after i successfully published my project and make it ".exe", it says
1) Cannot publish because a project failed to buiLd..
2) An error oCCurred whiLe signing: Signtool.exe not found..
what does this error means? please explain it to me, i appreciate much your efforts in heLping me, thanks a Lot..
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks