Hi can someone please help me with database connection, everything works fine my only problem's that when I compilethe project and install it on another machine and try to login it gives me this Error:

"‘C:\Documents and Settings\Developers\My Documents\Visual Studio 2005\Projects\ITDivision\ITDivision.mdb’ is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides"


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Security.Cryptography;
using System.Data.OleDb;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ITDivision
    public partial class Login : Form
        /// <summary>
        /// Key for the crypto provider
        /// </summary>
        private static readonly byte[] _key = { 0xA1, 0xF1, 0xA6, 0xBB, 0xA2, 0x5A, 0x37, 0x6F, 0x81, 0x2E, 0x17, 0x41, 0x72, 0x2C, 0x43, 0x27 };
        /// <summary>    
        /// Initialization vector for the crypto provider    
        /// </summary>    
        private static readonly byte[] _initVector = { 0xE1, 0xF1, 0xA6, 0xBB, 0xA9, 0x5B, 0x31, 0x2F, 0x81, 0x2E, 0x17, 0x4C, 0xA2, 0x81, 0x53, 0x61 };

        private OleDbConnection conn;

        public Login()

            conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Developers\Desktop\ITDivision\ITDivision\ITDivision.mdb");

for solving this error put your connection string in web.Config file in the Configuration tab
and then retrive it on the form with configuration manager. when you want to deploy project to another Computer @ that time just change the connection tring of your web.config file as per that computer . it will work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.