|
-
Jul 8th, 2003, 08:15 PM
#1
Thread Starter
Registered User
-
Jul 8th, 2003, 11:31 PM
#2
Frenzied Member
Is the DB on the same PC with the program or is the DB on another PC on the network?
-
Jul 9th, 2003, 12:06 AM
#3
Whats the code on and around line 297 of frmPrintReport?
-
Jul 9th, 2003, 01:48 AM
#4
Thread Starter
Registered User
The database is on the same PC.
Line 297 is inside the following function:
Code:
Private Sub subFillcboReportCode()
Try
'Open database connection
ReportConnection.Open()
'Clear ReportDataSet from last operation
ReportDataSet.Tables.Clear()
'Create SQL query to find Client Listing Code / Invoice Number
ReportDataAdapter.SelectCommand.CommandText = _
"SELECT " & strReportType & " " & _
"FROM " & strDatabaseTable & " " & _
"WHERE " & strDatabaseTable & "Date LIKE " & Chr(34) & strReportDate & Chr(34) & " " & _
"ORDER BY " & strReportType
'Fill ReportDataSet with rows resulting from query
ReportDataAdapter.Fill(ReportDataSet)
'Add ReportDataSet to cboReportCodeFrom & cboReportCodeTo
'Set dataTable
Dim dataTable As DataTable = ReportDataSet.Tables(0)
'Ensure dataTable not empty
If dataTable.Rows.Count <> 0 Then
'Retrieve total row in dataTable
Dim intTotalRow As Integer = dataTable.Rows.Count
'Clear items in cboReportCodeFrom & cboReportCodeTo
cboReportCodeFrom.Items.Clear()
cboReportCodeTo.Items.Clear()
'Add entries into cboReportCodeFrom & cboReportCodeTo
Dim intCounter As Integer
For intCounter = 0 To intTotalRow - 1
cboReportCodeFrom.Items.Add( _
Convert.ToString(dataTable.Rows(intCounter)(0)) _
)
cboReportCodeTo.Items.Add( _
Convert.ToString(dataTable.Rows(intCounter)(0)) _
)
Next
Else
'Clear items in cboReportCodeFrom & cboReportCodeTo
cboReportCodeFrom.Items.Clear()
cboReportCodeTo.Items.Clear()
End If
'Close database connection
ReportConnection.Close()
'Display verbose information with database exception
Catch oleDbExceptionParameter As System.Data.OleDb.OleDbException
MessageBox.Show(oleDbExceptionParameter.ToString, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
'Display message box when invalid operation
Catch invalidOperationExceptionParameter As InvalidOperationException
MessageBox.Show(invalidOperationExceptionParameter.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
when I run this program in my PC which I used to develop it, all fine, no problem / error.
but when I installed it on the new PC, then got this error.
please guide me. thank you.
-
Jul 9th, 2003, 02:36 AM
#5
Are you sure the connection string is correct? Any paths change or anything moving to the new pc? Which line is 297? The Fill method?
-
Jul 9th, 2003, 03:08 AM
#6
Thread Starter
Registered User
Everything is correct.
Line 297 is:
Code:
ReportDataAdapter.Fill(ReportDataSet)
Let me make myself clear again:
I developed this program "Invoice System" on PC-A. Everything is fine. I also created an Installer for this program.
I used the Installer to install "Invoice System" on PC-B. PC-B is a new PC, only has Windows XP Home Edition, Microsoft Access. After installing "Invoice System", I can open the program. But, it cannot interact with the database. Why? The error message is attachment on my 1st posting, please check it out.
Am I clear? How can I solve this problem? It seems like, for example, Microsoft developed Office, and works well on their PC. But when I install Office on my PC, then got problem...
Hope u guys can help me. Thank you.
Last edited by albertlse; Jul 9th, 2003 at 03:19 AM.
-
Jul 9th, 2003, 03:55 AM
#7
You were clear the first time. Have you tried running a simple 'SELECT * FROM MyTable' query from a compiled exe on PC - B? Is the problem really that it can't interact at all with a database or is it just that query on PC - B that doesn't work for some reason? Also when you installed on PC - B did you have administrative permissions on it? Are the parameters in the query the same on both machines (the values for strReportType, strDatabaseTable)?
Office is NOT needed to interact with an Access database, at least not in the method you are using.
-
Jul 9th, 2003, 04:31 AM
#8
Frenzied Member
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Jul 9th, 2003, 02:24 PM
#9
Lively Member
Did Lunatic solution work for you. If not are you willing to upload your code so we can try it.
Later
-
Jul 9th, 2003, 04:58 PM
#10
Lively Member
I think you should try a simple select command in place of the one you have, as someone has suggested.
This piece looks suspicious:
"WHERE " & strDatabaseTable & "Date LIKE "
Do you want the tablename there? and does it need a space before Date?
-
Jul 9th, 2003, 05:16 PM
#11
Date may also be a keywork and as such should be enclosed in [], but I think you said it ran fine on PC - A so I guess it can't be the code. The only thing I can think of is a Permissions problem or most likely what Lunatic posted. Good catch by the way, Lunatic.
-
Jul 9th, 2003, 11:09 PM
#12
Frenzied Member
Originally posted by Edneeis
Good catch by the way, Lunatic.
Long live Google!
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Jul 10th, 2003, 01:19 PM
#13
I wonder how many charact
Google is like the 2nd best development aid beside the computer you're developing on...
-
Jul 11th, 2003, 10:24 PM
#14
Thread Starter
Registered User
Thanks Lunatic3 and gearbolt and everyone, i think is the database file itself that cause problem. every thing is working fine now...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|