none
Insert didnt make any update in my Database RRS feed

  • Question

  • hey all ..

    i using sql ce 3.5 and i add db to my project and in the dataset, i draged Query from toolbox and i write query stetment and when i try to exextue this query from wizard it is run fine and insert the data into table

    but when i try to using the code

    queriesTableAdapter1.InsertQuery("ashraf");

    i got no error but no change in my database too ..

    any additional step to make sense in my database

    Tuesday, June 8, 2010 10:37 AM

Answers

  • Hi ashraf,

    "Copy if newer option is not recommended. The database file is copied from the project directory to the bin directory the first time the project is built. Every subsequent time you build the project, the Date Modified property of the files is compared. If the file in the project folder is newer, it is copied to the bin folder, replacing the file currently there. If the file in the bin folder is newer, then no files are copied. This setting persists any changes made to the data during run time, meaning every time you run your application and save changes to the data, those changes are visible the next time you run your application. However, the database file can change even when no changes are made to the data. Simply opening a connection (for example, expanding the Tables node in Server Explorer) on a data file can mark it as newer. Because of this unpredictable behavior, we recommended that you do not use this option.

    The Copy to Output Directory is set to Copy if newer or Copy always will overwrite the database in your output folder (the database being modified when testing your application) every time you build your project. "

    http://msdn.microsoft.com/en-us/library/ms233817(VS.80).aspx

    Best regards,
    Alex Liang


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, June 9, 2010 10:01 AM
    Moderator

All replies

  • Check the Copy to Output Directory property of your database file in your project (right-click on the database file in Solution Explorer, select Properties from the context menu). The default setting is Copy Always. Change the setting to Copy if newer.

     

    Tuesday, June 8, 2010 12:44 PM
  • hey mvp thx for replay but i still have the same problem i checked the Copy Output Directory and it is Copy if newer by defualt and nothing sound to data base and when i change it to copy always the same problem ...

    i want to add something : when i change the propority of Build action for database it is by defualt Content i change it to compile and i got two errors

     Error 3 Unexpected character '™' C:\Users\Ashraf EL-Hakim\Desktop\Graduation Projects\pro\SetDBforMob\SetDBforMob\Database1.sdf 1 2 SetDBforMob

    Error 4 A namespace does not directly contain members such as fields or methods C:\Users\Ashraf EL-Hakim\Desktop\Graduation Projects\pro\SetDBforMob\SetDBforMob\Database1.sdf 1 1 SetDBforMob

    when i try to double click on error the msgbox is appear contain "there is no editor avaliable for ........\database1.sdf make sure the application for file type .sdf is installed "

    maybe that is the reason ??

    Tuesday, June 8, 2010 5:57 PM
  • Hi ashraf,

    "Copy if newer option is not recommended. The database file is copied from the project directory to the bin directory the first time the project is built. Every subsequent time you build the project, the Date Modified property of the files is compared. If the file in the project folder is newer, it is copied to the bin folder, replacing the file currently there. If the file in the bin folder is newer, then no files are copied. This setting persists any changes made to the data during run time, meaning every time you run your application and save changes to the data, those changes are visible the next time you run your application. However, the database file can change even when no changes are made to the data. Simply opening a connection (for example, expanding the Tables node in Server Explorer) on a data file can mark it as newer. Because of this unpredictable behavior, we recommended that you do not use this option.

    The Copy to Output Directory is set to Copy if newer or Copy always will overwrite the database in your output folder (the database being modified when testing your application) every time you build your project. "

    http://msdn.microsoft.com/en-us/library/ms233817(VS.80).aspx

    Best regards,
    Alex Liang


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, June 9, 2010 10:01 AM
    Moderator
  • thx alex:) for help

    i have some issues too

    1- i have combox in windows mobile appliction form which take some data from database...

    when i try to use data bounds items .... i set the comboxs by wizard and i choose data source to my fav table data

    and display member to the column in fav table and value member also to the column in fav table

    and when i tried to run the program it is nothing in Comboxs

    and i tried this code : and it work fine but take veeeeeeeeeeery much time to load

    DataBaseDataSet ds = new DataBaseDataSet();
    
    DataBaseDataSet.Favorities1DataTable dt = new DataBaseDataSet.Favorities1DataTable();
    
    favorities1TableAdapter1.Fill(dt);
    
    foreach (DataRow dr in dt)
    
    {
    
    comboBox1.Items.Add(dr[1].ToString());
    
    
    }
    
    Wednesday, June 9, 2010 5:35 PM