3 Replies - 788 Views - Last Post: 11 December 2009 - 12:39 AM Rate Topic: -----

#1 Kingzo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 10-December 09

why my records in access delete each time i run my application!

Post icon  Posted 10 December 2009 - 02:36 AM

Have som problem with Access 2007, and visual studio 2008 C#. each time i try to run my program deletes all records in access. the fields are still there but only records disappears!!! conn.accdb exist in my solution explorer with

path : C:\Documents and Settings\kizmo\Dokumenter\Visual Studio 2008\Projects\conn\conn\conn.accdb

Here i have another copy of conn.accdb and this is the one which all records deletes after running...... C:\Documents and Settings\kizmo\Dokumenter\Visual Studio 2008\Projects\conn\conn\bin\Debug

i am not sure why i have to have 2 exactly samme database file i different directories.

thx

Is This A Good Question/Topic? 0
  • +

Replies To: why my records in access delete each time i run my application!

#2 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: why my records in access delete each time i run my application!

Posted 10 December 2009 - 03:14 AM

Most probably you are doing something wrong. There is no need to have two identical databases in two different directories.

Anyway, it's impossible to say what is causing this. First, verify all your SQL queries.

Second: How did you connect to your database? Are you using any wizards related to your database (for getting records, inserting records, connecting to database,...)?

It would be desirable if you posted some code.
Was This Post Helpful? 0
  • +
  • -

#3 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1533
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: why my records in access delete each time i run my application!

Posted 10 December 2009 - 05:38 AM

would be nice if we could see some code. We aren't mind readers, and we can't see your problem if we can't see the code.
Was This Post Helpful? 0
  • +
  • -

#4 Kingzo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 10-December 09

Re: why my records in access delete each time i run my application!

Posted 11 December 2009 - 12:39 AM

connection to db looks like ..............

OleDbConnection aConnection = new OleDbConnection(ConfigurationManager.ConnectionStrings["Konsolidering.Properties.Settings.KonsolideringConnectionString"].ToString());

aConnection.Open();
OleDbCommand aCommand = new OleDbCommand(" SELECT Kalibrering.[Kalibreringsfaktor 11], Kalibrering.[Kalibreringsdato 11], " +
" Kalibrering.[Kalibreringsdato 12], Kalibrering.[Kalibreringsfaktor 12]," +
" Transducer.[Transducer 11], Transducer.[Transducer 12] "+
" FROM Transducer INNER JOIN Kalibrering ON Transducer.[Transducer ID] = Kalibrering.[Transducer ID]", aConnection);


OleDbDataReader dr = aCommand.ExecuteReader();
while (dr.Read())

app.config.. looks like

<connectionStrings>
<add name="Konsolidering.Properties.Settings.KonsolideringConnectionString"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Konsolidering.accdb"
providerName="System.Data.OleDb" />
</connectionStrings>
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1