Error when running my app on another machine-VBForums
Results 1 to 5 of 5

Thread: Error when running my app on another machine

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    169

    Error when running my app on another machine

    Hello, I finished my program, it runs fine on my computer. However when I try it on virtual machine (Win7) I'm getting error something like: Invalid value for attachDbfilename. Here's a screenshot:



    Here's full error output: https://gist.github.com/nikel/7cf254...aed24d9ee43483

    I defined attachdbfilename like this:

    VB.NET Code:
    1. private void Form1_Load(object sender, EventArgs e)
    2. {
    3.     SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
    4.     builder.DataSource = @"(LocalDB)\MSSQLLocalDB";
    5.     builder.AttachDBFilename = @"|DataDirectory|\database\gazi_db.mdf";
    6.     builder.IntegratedSecurity = true;
    7.     builder.ConnectTimeout = 30;
    8.  
    9.     sqlConnection = new SqlConnection(builder.ConnectionString);
    10.     ...

    How can I fix this?

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    96,588

    Re: Error when running my app on another machine

    How did you deploy the app? XCOPY, ClickOnce or something else? Regardless of the how, the error message clearly indicates that there is no file named 'gari_db.mdf' in the 'database' subfolder of your data directory. What you need to do about it depends on the how.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    169

    Re: Error when running my app on another machine

    Hello, I don't have any built in setups. I just want to zip "Release" (if required "Debug") folder and run on anther machine. Because these machines don't have internet connection. I've heard XCOPY for the first time, need to search about it.

    I have mdf files both in exe and and exe\database directories. In fact I don't know where to put them.

    I created database from gui, if it makes sense.

    One more thing, do I have to set server name?

    Thank you for your reply.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2013
    Posts
    169

    Re: Error when running my app on another machine

    I installed Windows 7 English and sql localdb. Now I'm getting another error:



    https://gist.github.com/nikel/fabb0a...d33fcab0f8ee0c

    and this: Object reference not set to an instance of an object
    (like the previous one)

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    96,588

    Re: Error when running my app on another machine

    If the error message says that it couldn't find the server and/or instance specified then that's what happened. If it was me, when an error log told me that the instance I expected to be there wasn't there, I'd look to see what instances there were there.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.