Click here to Skip to main content
15,920,217 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: how to create PDF in vb.net? Pin
Sathesh Sakthivel19-Jul-07 2:34
Sathesh Sakthivel19-Jul-07 2:34 
QuestionExtracting a single record from a SQL database Pin
aqzman_19-Jul-07 1:43
aqzman_19-Jul-07 1:43 
AnswerRe: Extracting a single record from a SQL database Pin
Colin Angus Mackay19-Jul-07 1:54
Colin Angus Mackay19-Jul-07 1:54 
GeneralRe: Extracting a single record from a SQL database Pin
aqzman_19-Jul-07 2:10
aqzman_19-Jul-07 2:10 
AnswerRe: help Pin
kubben19-Jul-07 1:46
kubben19-Jul-07 1:46 
Jokemore meaningful subject Pin
Luc Pattyn19-Jul-07 2:43
sitebuilderLuc Pattyn19-Jul-07 2:43 
GeneralRe: more meaningful subject Pin
kubben19-Jul-07 2:51
kubben19-Jul-07 2:51 
QuestionError when connecting to Ms access database Pin
Mekong River19-Jul-07 0:34
Mekong River19-Jul-07 0:34 
Hi, I got a problem that I could not solve when try to read my data from ms access database into the list box. I have the following code:
Under the form public class:

Private WithEvents cnnDonorDb As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\DICDonorDb\DICDornorDb.mdb'; Persist Security Info=False")


I add the following code to form load event to get data from the database to the list box:

Dim cmdOrgType As New OleDbCommand
        With cmdOrgType
            .Connection = cnnDonorDb
            .CommandType = CommandType.Text
            .CommandText = "SELECT * FROM tblOrgType.OrgType ORDER BY tblOrgType.OrgType;"
        End With

        ' Open the connection.
        cmdOrgType.Connection.Open()
        ' Execute the command to the return the list of organization type.
        cmdOrgType.ExecuteReader() ' HERE IS THE PLACE THAT I GET AN ERROR
        Dim drdResult As OleDbDataReader

        ' Get the list of organization type and put it in the list box.
        While drdResult.Read
            For colOrgType As Integer = 0 To drdResult.FieldCount - 1
                lsbOrgInfo.Items.Add(drdResult(colOrgType).ToString)
            Next

        End While
        ' Close the result.
        drdResult.Close()
        ' Close the connection
        cmdOrgType.Connection.Close()


I got an error as the following message:

Could not find file 'C:\Documents and Settings\roathkanel\My Documents\Visual Studio 2005\Projects\DIC Donor Database\DIC Donor Database\bin\Debug\tblOrgType.mdb'.


I really don't understand why the database path in this message is difference from database path in C: drive. As you can see the path in the connection string is C:\DICDonorDb\DICDornorDb.mdb. I'm sure that the file is located in this folder because I didn't type it, i copy the string path and file name into my code editor.

Please help me to solve this problem. I'm using VB 2005.
Thank in advance!!!
AnswerRe: Error when connecting to Ms access database Pin
Dave Kreskowiak19-Jul-07 3:44
mveDave Kreskowiak19-Jul-07 3:44 
GeneralRe: Error when connecting to Ms access database Pin
Mekong River19-Jul-07 17:44
Mekong River19-Jul-07 17:44 
GeneralRe: Error when connecting to Ms access database Pin
Dave Kreskowiak20-Jul-07 2:28
mveDave Kreskowiak20-Jul-07 2:28 
GeneralRe: Error when connecting to Ms access database Pin
Mekong River22-Jul-07 15:39
Mekong River22-Jul-07 15:39 
QuestionHow To AOP IN VB.NET Pin
tomaka18-Jul-07 23:43
tomaka18-Jul-07 23:43 
AnswerRe: How To AOP IN VB.NET Pin
Dave Kreskowiak19-Jul-07 3:29
mveDave Kreskowiak19-Jul-07 3:29 
QuestionProblem on Executing application path in VB6.0 Pin
Srinivas Kaparthi18-Jul-07 23:31
Srinivas Kaparthi18-Jul-07 23:31 
AnswerRe: Problem on Executing application path in VB6.0 Pin
Navneet Hegde19-Jul-07 2:38
Navneet Hegde19-Jul-07 2:38 
GeneralRe: Problem on Executing application path in VB6.0 Pin
Srinivas Kaparthi21-Jul-07 1:02
Srinivas Kaparthi21-Jul-07 1:02 
QuestionAccess form1 from form2. Pin
KOKEMO18-Jul-07 23:23
KOKEMO18-Jul-07 23:23 
AnswerRe: Access form1 from form2. Pin
Colin Angus Mackay18-Jul-07 23:39
Colin Angus Mackay18-Jul-07 23:39 
AnswerRe: Access form1 from form2. Pin
Naji El Kotob19-Jul-07 0:07
Naji El Kotob19-Jul-07 0:07 
AnswerRe: Access form1 from form2. Pin
Dave Kreskowiak19-Jul-07 3:13
mveDave Kreskowiak19-Jul-07 3:13 
GeneralRe: Access form1 from form2. Pin
Paul Conrad19-Jul-07 9:34
professionalPaul Conrad19-Jul-07 9:34 
GeneralRe: Access form1 from form2. Pin
Dave Kreskowiak19-Jul-07 15:55
mveDave Kreskowiak19-Jul-07 15:55 
JokeRe: Access form1 from form2. Pin
Paul Conrad19-Jul-07 16:02
professionalPaul Conrad19-Jul-07 16:02 
Questioneasy way to print datagrid ? Pin
Mr.Kode18-Jul-07 23:16
Mr.Kode18-Jul-07 23:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.