Thursday 15 March 2012

.net - Database only saving to debug folder -


I have a program that is saving data in Access database. I have code to save for database:

  Dim ConnString as string = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = \\ phipnasw01 \ Users \ hip $ \ cerns1 \ My Documents \ \ Visual Studio 2010 Projects \ Fort Data Gatherer \ "Fort Data Gatherer \ Example1.accdb" CNN New OleDbConnection (ConnString) 'is getting the number of characters in all variables diminished. GlobalVariables.mdbProdDate = Mid (GlobalWaribles.STAdRACE, 2, 19) GlobalVibrils. MDBBlline = Mid (Global Virities. StardC, 21, 3) Global Weiribles. MDBBLAN = Mid (Global Vibrities.ASTADAC, 33, 12) GlobalVibles. New line Mdibigrasd ak = Mid (Globalwॅriabls stAddRec, 46, 6) GlobalVariables.mdbAirDry = Middle (GlobalVariables.stAddRec, 53, 7) GlobalVariables.mdbInvoiceWeight = Middle (GlobalVariables.stAddRec, 60, 8) cnn.Open () 'QUERY1 Naming of Dim newQuery1Row example 1DataSet1.Query1Row newQuery1Row = Me.Example1DataSet1.Query1.NewQuery1Row () 'Date creating the first line newQuery1Row.ProdDate = GlobalVariables.mdbProdDate newQuery1Row.BaleLine = GlobalVariables.mdbBaleLine newQuery1Row.BaleNumber = GlobalVariables.mdbBaleNumber newQuery1Row.GrossWeight = GlobalVariables MdbGrossWeight newQuery1Row.AirDry = GlobalVariables.mdbAirDry newQuery1Row.InvoiceWeight = GlobalVariables.mdbInvoiceWeight 'Add Row to the Table. Me.Example1DataSet1.Query1.Rows.Add (newQuery1Row) cnn.Close () 'Saving line entry Me.Query1TableAdapter.Update (Me.Example1DataSet1.Query1) after   

The code runs the program only delivers files correctly to Access Database in debug folder. I need a database to save the database access in C: \ Fort \ Example1.accdb

as the dim ConnString string = "provider = Microsoft.ACE.OLEDB.12.0, data source = \\ phipnasw01 \ users hip $ \ cerns1 \ My Documents \ visual Studio 2010 \ projects \ Fort data Gatherer \ Fort Data Gatherer \ Example1.accdb is right "

the path connection string, you coded it hard. To save only one or something, create a string at run-time wherever you want.

No comments:

Post a Comment