473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Trying to make a connection a database on a server

55
I need help to connect to an access db which is on a server,I did the follwing but i had an error.how do i correct this?


string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=100.0201.01\\BordercomTrainersDB.mdb";
string strSQL = "SELECT * FROM CoursesTable";
// create Objects of ADOConnection and ADOCommand
OleDbConnection myConn = new OleDbConnection(strDSN);
OleDbDataAdapter myCmd = new OleDbDataAdapter(strSQL, myConn);
try
{
myConn.Open();
DataSet dtSet = new DataSet();
myCmd.Fill(dtSet, "CourseName");
DataTable dTable = dtSet.Tables[0];
foreach (DataRow dtRow in dTable.Rows)
{

comboBox1.Items.Add(dtRow["CourseName"].ToString());

}
}
Jul 2 '07 #1
2 897
nateraaaa
663 Expert 512MB
I need help to connect to an access db which is on a server,I did the follwing but i had an error.how do i correct this?


string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=100.0201.01\\BordercomTrainersDB.mdb";
string strSQL = "SELECT * FROM CoursesTable";
// create Objects of ADOConnection and ADOCommand
OleDbConnection myConn = new OleDbConnection(strDSN);
OleDbDataAdapter myCmd = new OleDbDataAdapter(strSQL, myConn);
try
{
myConn.Open();
DataSet dtSet = new DataSet();
myCmd.Fill(dtSet, "CourseName");
DataTable dTable = dtSet.Tables[0];
foreach (DataRow dtRow in dTable.Rows)
{

comboBox1.Items.Add(dtRow["CourseName"].ToString());

}
}
Please post the error that you received.

Nathan
Jul 2 '07 #2
napstar
55
c:\documents and settings\chris\my documents\visual studio 2005\projects\Bordercom\BordercomTrainers\bin\debu g\ \\Server1\training\\BordercomTrainersDB.mdb is not a valid path.Make sure path name is spelled correctly correct and that you are connected to the server on which the file resides.
Jul 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: sparks | last post by:
So far I have tried the microsoft version of this, and lost the table LOl so I tried this way to write to two tables carrying over the autoid but so far I can not get the autonumber and put it in...
6
by: Frank Wilson | last post by:
Tom, It sounds to me like ASP, not ASP.NET is handling the request for WebForm1.aspx. This is most likely an IIS config issue that may have been caused by order of installation or...
7
by: djc | last post by:
I have several subroutines (all inline code) that wind up using the same database connection object variable. I have been declaring a new variable in every sub. I just now came to a point where I...
2
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current...
7
by: John Blair | last post by:
Hi, I am trying to get the datacache1 sample working on my PC. I have downloaded the MSDE 2000 sample SQL Server database and the pubs sample database and installed it. I can view the contents...
14
by: GabrielESandoval | last post by:
I need to make a registration page for a community service volleyball tournament our organization is doing. I am VERY NEW to ASP. Would the easiest way to make it be just doing it on frontpage...
1
by: Developer | last post by:
Dear Group Member, I am sorry if I have posted this query in wrong group, but since this is connected with ASPO.NET2.0, thought of posting here. I am doing a very simple program where I am...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
5
by: Alan Silver | last post by:
Hello, Server configuration: Windows 2003 Server SP2 SQL Server 2000 SP4 ..NET v2.0.50727 just built up a new server using the same configuration as my current one. I even used the same CDs...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.