none
how to make working WPF 2010 program make changes to SQL Server 2008 Express files RRS feed

  • Question

  • (1) I have a working WPF 2010 program that manipulates a table in SQL Server 2008 Express

    (2) the program does delete, update, select and insert correctly however

    in its own project file folder logbooklmk.mdf   logbooklmk_log.ldf

    (3) I want the actual SQL Server 2008 express files to be changed

    yes I know the issue is sharing and the copy option only applies to the local project files.

    I found this out by trying always copy, never copy and copy if newer ( in case this is asked)

    I changed the connection to point to the

    "C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESSLMK\MSSQL\DATA"  directory

    Tried that once and it failed. The program switches itself back to the original files

    in the project directory.

    Something about sharing not allowed.

    In the VS2010 project, I can set up logbooklmk.mdf to be accessed in the SQL Server 2008 Express

    area under "C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESSLMK\MSSQL\DATA"

    but then sql server management studio will not access the table.

    _______

    if I physically move the files logbooklmk.mdf   logbooklmk_log.ldf to

    C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESSLMK\MSSQL\DATA

    then sql server management studio shows the changes made to the table made by my program.

    Somebody changed the title question so that it makes no sense!

     

    • Moved by Bob Beauchemin Saturday, September 4, 2010 5:08 AM Moved to a possible more relevent forum (From:.NET Framework inside SQL Server)
    Friday, September 3, 2010 5:22 PM

Answers

  • Hello,

    Thanks for your thread!

    Since you work with WPF applications and want to make changes to database, please allow me to assume that what attempted to do data binding in WPF programs. Here is a tutorial demonstrated how to do databinding in WPF:
    http://msdn.microsoft.com/en-us/library/aa480224.aspx

    Please let  me if it is what you want. Otherwise, can you please clarify what's your problem? If possible, please post a code snippet/steps to reproduce the issue. By the way, there is a WPF forum here. You can post there if you are unclear anything about WPF.

    Best regards


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    • Marked as answer by liurong luo Friday, September 24, 2010 10:06 AM
    Friday, September 10, 2010 8:48 AM

All replies

  • Hello,

    Thanks for your thread!

    Since you work with WPF applications and want to make changes to database, please allow me to assume that what attempted to do data binding in WPF programs. Here is a tutorial demonstrated how to do databinding in WPF:
    http://msdn.microsoft.com/en-us/library/aa480224.aspx

    Please let  me if it is what you want. Otherwise, can you please clarify what's your problem? If possible, please post a code snippet/steps to reproduce the issue. By the way, there is a WPF forum here. You can post there if you are unclear anything about WPF.

    Best regards


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    • Marked as answer by liurong luo Friday, September 24, 2010 10:06 AM
    Friday, September 10, 2010 8:48 AM
  • my post was alread moved once

    I have explained at length the problem in my initial post and that will be that.

    Friday, September 10, 2010 9:56 PM
  • Hello landon1,

    Thanks for your reply!

    Here is what I can say:

    1. you tried delete/update/select/insert data to a database file (logbooklmk.mdf in this case)
    2. you successfuly done that if the database file exists in the project file folder.
    3. you change the connection to point to the file in C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESSLMK\MSSQL\DATA but that failed.
    4. physically move the file to C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESSLMK\MSSQL\DATA, it works.

    Could you please allow me to ask a few questions?
     1. what do you want to achieve? or what's your requirement?
     2. What do you mean by saying "sql server management studio will not access the table"?
     3. Are there any error messages when you failed in #3?

    Thanks a lot!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Wednesday, September 15, 2010 11:27 AM
  • defeintely NOT AN ANSWER

    you can't just whiz through posts offering a few words of advice to increase your score

    You must read the original post first carefully.

    Friday, September 24, 2010 2:17 PM
  • If I understand correctly, you want to connect to the SQL Server which is running as a system service, as opposed to a user instance?

    If that is correct, then you need to do the following:

    1. Move the mdf to the SQL Server's data directory (in your case: "C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESSLMK\MSSQL\DATA")
    2. Use SQL Management Studio to connect to the local SQL Server
    3. Attach your mdf to the local SQL Server (http://msdn.microsoft.com/en-us/library/ms190209(v=SQL.100).aspx)
    4. Change your connection string to connect to the attached database, instead of attempting to attach the database (for instance use: "Server=.\SQLExpress;Database=logbooklmk;Trusted_Connection=True;")

    If my understanding above is incorrect, please let me know where you are trying to put the mdf files and what connection string you are using and we'll go from there.

    Friday, September 24, 2010 9:56 PM
    Moderator
  • already tried your suggestion but I will retry and gather the error messages.

    Many of questions are answered by simply reading my original post!

     

    Saturday, September 25, 2010 6:08 PM