14 Replies - 360 Views - Last Post: 28 January 2019 - 02:14 AM Rate Topic: -----

#1 nyt1972   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 04-February 10

Column does not belong to table

Posted 26 January 2019 - 12:25 AM

Hello,

Below is my query which works fine in Management Studio but when I run the code in vb.net it gives me the error below:

 dbconn.AddParams("@d1", txtReceipt.Text)
            dbconn.executequery("SELECT tblFeePayment.ID AS ReceiptNO, tblFeePayment.admission_no, tblSession.ID as sessionid, tblClass.ID as classid,  
                         tblFeePayment.section_id as sectionid,  tblFeePayment.classfee, tblFeePayment.catdiscount, tblFeePayment.studiscount, tblFeePayment.feetype_id, 
                         tblFeePayment.feepart_id, tblFeePayment.payable, tblFeePayment.paidamount, tblFeePayment.paid, tblFeePayment.paiddate, tblSection.SectionName, 
                         tblClass.ClassName, tblSession.session, tblStuCategory.Category, tblStudent.StudentName, tblStudent.FatherName
FROM            tblFeePayment INNER JOIN
                         tblSection ON tblFeePayment.section_id = tblSection.ID INNER JOIN
                         tblClass ON tblSection.class_id = tblClass.ID INNER JOIN
                         tblSession ON tblClass.session_id = tblSession.ID INNER JOIN
                         tblEnrollment ON tblFeePayment.enroll_ID = tblEnrollment.ID AND tblSection.ID = tblEnrollment.Section_ID INNER JOIN
                         tblStudent ON tblFeePayment.admission_no = tblStudent.AdmissionNo AND tblEnrollment.AdmissionNo = tblStudent.AdmissionNo INNER JOIN
                         tblStuCategory ON tblFeePayment.category_id = tblStuCategory.ID AND tblEnrollment.Category_ID = tblStuCategory.ID WHERE tblFeePayment.ID = @d1")



in this line
cmbSession.SelectedValue = dbconn.dt.Rows(0).Item("sessionid")

Error:

Quote

the error is
An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll

Additional information: Column 'sessionid' does not belong to table .



If I run the below code it show me all the field names correctly and the values as well

For i As Integer = 0 To dbconn.dt.Columns.Count - 1
                    MsgBox(dbconn.dt.Columns(i).ColumnName & " " & dbconn.dt.Rows(0).Item(i))
                Next


pls help.

This post has been edited by nyt1972: 26 January 2019 - 12:45 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Column does not belong to table

#2 andrewsw   User is offline

  • Stealth IT
  • member icon

Reputation: 6737
  • View blog
  • Posts: 27,741
  • Joined: 12-December 12

Re: Column does not belong to table

Posted 26 January 2019 - 04:18 AM

Are you running against the same database? Is the column referenced in the correct table? Is there an underscore?
Was This Post Helpful? 0
  • +
  • -

#3 nyt1972   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 04-February 10

Re: Column does not belong to table

Posted 26 January 2019 - 08:01 AM

View Postandrewsw, on 26 January 2019 - 04:18 AM, said:

Are you running against the same database? Is the column referenced in the correct table? Is there an underscore?



Yes to all, as I copied the query from management studio and the below code show all columns names and values correctly.

For i As Integer = 0 To dbconn.dt.Columns.Count - 1
                    MsgBox(dbconn.dt.Columns(i).ColumnName & " " & dbconn.dt.Rows(0).Item(i))
                Next

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,272
  • Joined: 12-June 08

Re: Column does not belong to table

Posted 26 January 2019 - 08:07 AM

I would need to see the larger context of where the error is happening and the surrounding code.
Was This Post Helpful? 0
  • +
  • -

#5 nyt1972   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 04-February 10

Re: Column does not belong to table

Posted 26 January 2019 - 08:19 AM

at System.Data.DataRow.GetDataColumn(String columnName)
at System.Data.DataRow.get_Item(String columnName)
at AnsiSchoolERP.frmFeePayment.txtReceipt_KeyDown(Object sender, KeyEventArgs e) in D:\Projects\vb.net\A_new\AnsiSchoolERP\AnsiSchoolERP\Forms\frmFeePayment.vb:line 263
at System.Windows.Forms.Control.onkeydown(KeyEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
at System.Windows.Forms.Nativewindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at AnsiSchoolERP.frmMain.Button22_Click(Object sender, EventArgs e) in D:\Projects\vb.net\A_new\AnsiSchoolERP\AnsiSchoolERP\Forms\frmMain.vb:line 189
at System.Windows.Forms.Control.onclick(EventArgs e)
at System.Windows.Forms.Button.onclick(EventArgs e)
at System.Windows.Forms.Button.onmouseup(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
at System.Windows.Forms.Nativewindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at AnsiSchoolERP.My.MyApplication.Main(String[] Args) in :line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,272
  • Joined: 12-June 08

Re: Column does not belong to table

Posted 26 January 2019 - 08:26 AM

Where's the code where you are filling the data set?

As of right now it looks like you are trying to pull the results from the query from your data connection "dbconn"..

.. and that is wrong.
Was This Post Helpful? 0
  • +
  • -

#7 nyt1972   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 04-February 10

Re: Column does not belong to table

Posted 26 January 2019 - 08:30 AM

Actually dbconn is object of the Class I created for database connection, and records saving and retrieving etc.

The problem is that in the same document I have this kind of code and that works fine but this one is giving me this error. below is the whole document.

Imports DevExpress.XtraReports.UI

Public Class frmFeePayment
    Dim dbconn As New SQLConn
    Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
        If txtReceiptID.Text = "" Then
            MsgBox("Receipt may not be generated")
            Exit Sub
        End If
        If cmbAdmissionNo.Text = "" Then
            MsgBox("Admission No may not be blank")
            Exit Sub
        End If
        If txtFeeAmount.Text = "" Then
            MsgBox("Type Amount to be paid")
            Exit Sub
            txtFeeAmount.Focus()
        End If
        UpdateFeePaid()

    End Sub

    Private Sub UpdateFeePaid()
        dbconn.AddParams("@d1", txtReceiptID.Text)
        dbconn.AddParams("@d2", txtFeeAmount.Text)
        dbconn.AddParams("@d3", Date.Now())
        dbconn.executequery("Update tblFeePayment Set [email protected], paid=1 , [email protected] Where [email protected]")
        If dbconn.hasException(True) Then Exit Sub
        MsgBox("Fee Paid successfully!")
        LoadFee()
    End Sub

    Private Sub btnNew_Click(sender As Object, e As EventArgs) Handles btnNew.Click
        Reset()
    End Sub

    Sub Reset()
        cmbSession.Text = ""
        txtSessionID.Text = ""
        cmbClass.Text = ""
        txtClassID.Text = ""
        cmbfeetype.Text = ""
        txtFeeTypeID.Text = ""
        cmbFeePart.Text = ""
        txtFeeTypeID.Text = ""
        cmbAdmissionNo.Text = ""
        txtFeeAmount.Text = ""
    End Sub

    Private Sub frmFeePayment_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        fillcmbSession()
    End Sub

    Private Sub fillcmbSession()
        dbconn.executequery("SELECT * FROM tblsession")
        If dbconn.hasException(True) Then Exit Sub
        cmbSession.DisplayMember = "session"
        cmbSession.ValueMember = "ID"
        cmbSession.DataSource = dbconn.dt
        SetCurrentSession()
    End Sub

    Private Sub SetCurrentSession()
        dbconn.executequery("SELECT * from tblsession WHERE is_current=1;")
        If dbconn.hasException(True) Then Exit Sub
        If dbconn.dt.Rows.Count > 0 Then
            cmbSession.SelectedValue = dbconn.dt.Rows(0).Item("ID")
        End If
    End Sub

    Private Sub cmbSession_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbSession.SelectedIndexChanged
        If cmbSession.SelectedIndex <> -1 Then
            txtSessionID.Text = cmbSession.SelectedValue
            fillcmbClass()
        End If
    End Sub

    Private Sub fillcmbClass()
        cmbClass.DataSource = Nothing
        dbconn.AddParams("@d1", txtSessionID.Text)
        dbconn.executequery("Select * from tblClass WHERE [email protected];")
        If dbconn.hasException(True) Then Exit Sub
        cmbClass.DisplayMember = "ClassName"
        cmbClass.ValueMember = "ID"
        cmbClass.DataSource = dbconn.dt
    End Sub

    Private Sub cmbClass_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbClass.SelectedIndexChanged
        If cmbClass.SelectedIndex <> -1 Then
            txtClassID.Text = cmbClass.SelectedValue
            fillcmbFeeType()
            fillAdmissionNo()
        End If
    End Sub

    Private Sub fillAdmissionNo()
        dbconn.AddParams("@d1", txtClassID.Text)
        dbconn.executequery("select AdmissionNo from tblEnrollment Where [email protected]")
        cmbAdmissionNo.DisplayMember = "AdmissionNo"
        cmbAdmissionNo.ValueMember = "AdmissionNo"
        cmbAdmissionNo.DataSource = dbconn.dt
        cmbAdmissionNo.AutoCompleteSource = AutoCompleteSource.ListItems
        cmbAdmissionNo.AutoCompleteMode = AutoCompleteMode.SuggestAppend
    End Sub

    Private Sub fillcmbFeeType()
        dbconn.AddParams("@d1", txtClassID.Text)
        dbconn.executequery("Select Distinct tblFeeType.ID,tblFeeType.FeeType from tblFeeType
INNER JOIN tblClassFee ON tblFeeType.ID = tblClassFee.FeeType_ID
Where tblClassFee.Class_ID [email protected]")
        If dbconn.hasException(True) Then Exit Sub
        cmbfeetype.DisplayMember = "FeeType"
        cmbfeetype.ValueMember = "ID"
        cmbfeetype.DataSource = dbconn.dt
    End Sub

    Private Sub cmbfeetype_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbfeetype.SelectedIndexChanged
        If cmbfeetype.SelectedIndex <> -1 Then
            txtFeeTypeID.Text = cmbfeetype.SelectedValue
            txtFeeAmount.Text = ""
            fillcmbParticular()
            'fillGrid()
        End If
    End Sub

    Private Sub fillcmbParticular()
        dbconn.AddParams("@d1", txtFeeTypeID.Text)
        dbconn.executequery("Select * from tblFeeParts Where [email protected]")
        If dbconn.hasException(True) Then Exit Sub
        cmbFeePart.ValueMember = "ID"
        cmbFeePart.DisplayMember = "Particular"
        cmbFeePart.DataSource = dbconn.dt
    End Sub

    Private Sub cmbFeePart_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbFeePart.SelectedIndexChanged
        If cmbFeePart.SelectedIndex <> -1 Then
            txtFeePartID.Text = cmbFeePart.SelectedValue
            If cmbAdmissionNo.Text <> "" Then
                LoadFee()
            End If
        End If
    End Sub

    Private Sub LoadFee()
        dbconn.AddParams("@d1", txtSessionID.Text)
        dbconn.AddParams("@d2", txtClassID.Text)
        dbconn.AddParams("@d3", txtFeeTypeID.Text)
        dbconn.AddParams("@d4", txtFeePartID.Text)
        dbconn.AddParams("@d5", cmbAdmissionNo.Text)
        dbconn.executequery("Select ID From tblFeePayment WHERE [email protected] and [email protected] and
[email protected] And [email protected] and [email protected]")
        If dbconn.hasException(True) Then Exit Sub
        If dbconn.dt.Rows.Count > 0 Then
            txtReceiptID.Text = dbconn.dt.Rows(0).Item("ID")
            If txtReceiptID.Text = "" Then
                MsgBox("No Receipt generated for this")
                Exit Sub
            Else
                dbconn.AddParams("@d1", txtReceiptID.Text)
                dbconn.executequery("SELECT tblFeePayment.ID as ReceiptNO
      ,admission_no,enroll_ID,tblStudent.StudentName ,tblStudent.FatherName
      ,classfee, CatDiscount, StuDiscount,payable ,paidamount ,paid  ,paiddate
  FROM tblFeePayment 
  LEFT OUTER JOIN tblStudent ON tblStudent.AdmissionNo = tblFeePayment.admission_no
  WHERE tblFeePayment.ID = @d1")
                If dbconn.hasException(True) Then Exit Sub
                lblName.Text = dbconn.dt.Rows(0).Item("StudentName")
                lblFName.Text = dbconn.dt.Rows(0).Item("FatherName")
                lblClassFee.Text = dbconn.dt.Rows(0).Item("ClassFee")
                lblPaid.Text = dbconn.dt.Rows(0).Item("paidamount")
                lblDueDate.Text = dbconn.dt.Rows(0).Item("paiddate")
                lblCatDiscount.Text = dbconn.dt.Rows(0).Item("CatDiscount")
                lblStuDisc.Text = dbconn.dt.Rows(0).Item("StuDiscount")
                lblPayable.Text = dbconn.dt.Rows(0).Item("payable")
                txtFeeAmount.Text = dbconn.dt.Rows(0).Item("payable")
                dbconn.AddParams("@d1", cmbAdmissionNo.Text)
                dbconn.executequery("Select sum(t.balance) as Balance
From
(SELECT tblFeePayment.ID as ReceiptNO
      ,admission_no
	  ,payable - paidamount as balance
  FROM tblFeePayment  
  WHERE admission_no = @d1 )t")
                If dbconn.hasException(True) Then Exit Sub
                lblPBalance.Text = dbconn.dt.Rows(0).Item("Balance")
            End If
        End If
    End Sub

    Private Sub cmbAdmissionNo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbAdmissionNo.SelectedIndexChanged
        If cmbAdmissionNo.SelectedIndex <> -1 Then
            LoadFee()
        End If
    End Sub

    Private Sub cmbAdmissionNo_Leave(sender As Object, e As EventArgs) Handles cmbAdmissionNo.Leave
        If cmbAdmissionNo.SelectedIndex = -1 Then
            txtReceiptID.Text = ""
            cmbAdmissionNo.Text = ""
            cmbAdmissionNo.Focus()
        End If
    End Sub

    Private Sub cmbAdmissionNo_KeyDown(sender As Object, e As KeyEventArgs) Handles cmbAdmissionNo.KeyDown
        If e.KeyCode = Keys.Enter Then
            If cmbAdmissionNo.SelectedIndex = -1 Then
                txtReceiptID.Text = ""
                cmbAdmissionNo.Text = ""
                cmbAdmissionNo.Focus()
            End If
        End If
    End Sub

    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click
        If cmbAdmissionNo.SelectedIndex <> -1 Then
            Dim Report1 As New RptGenFeeReceipts
            Report1.ScriptLanguage = DevExpress.XtraReports.ScriptLanguage.VisualBasic
            Dim tool As ReportPrintTool = New ReportPrintTool(Report1)
            Report1.AdmissionNo.Visible = False
            Report1.AdmissionNo.Value = cmbAdmissionNo.Text
            Report1.EnrollID.Visible = False
            Report1.SessionID.Value = txtSessionID.Text
            Report1.SessionID.Visible = False
            Report1.ClassName.Value = txtClassID.Text
            Report1.ClassName.Visible = False
            Report1.FeeTypeID.Value = txtFeeTypeID.Text
            Report1.FeeTypeID.Visible = False
            Report1.FeePart.Value = txtFeePartID.Text
            Report1.FeePart.Visible = False
            Report1.CreateDocument()
            Report1.ShowPreview()
        End If
    End Sub

    [b]Private Sub txtReceipt_KeyDown(sender As Object, e As KeyEventArgs) Handles txtReceipt.KeyDown
        If e.KeyCode = Keys.Enter Then
            '  cmbAdmissionNo.SelectedIndex = -1
            dbconn.AddParams("@d1", txtReceipt.Text)
            dbconn.executequery("SELECT        tblFeePayment.ID AS ReceiptNO, tblFeePayment.admission_no as adm, tblFeePayment.session_ID as sid, tblFeePayment.class_id as cid,  
                         tblFeePayment.section_id as secid,  tblFeePayment.classfee as cf, tblFeePayment.catdiscount, tblFeePayment.studiscount, tblFeePayment.feetype_id, 
                         tblFeePayment.feepart_id, tblFeePayment.payable, tblFeePayment.paidamount, tblFeePayment.paid, tblFeePayment.paiddate, tblSection.SectionName, 
                         tblClass.ClassName, tblSession.session, tblStuCategory.Category, tblStudent.StudentName, tblStudent.FatherName
FROM            tblFeePayment INNER JOIN
                         tblSection ON tblFeePayment.section_id = tblSection.ID INNER JOIN
                         tblClass ON tblFeePayment.class_id = tblClass.ID INNER JOIN
                         tblSession ON tblFeePayment.session_id = tblSession.ID 
						 INNER JOIN
                         tblStudent ON tblFeePayment.admission_no = tblStudent.AdmissionNo  INNER JOIN
                         tblStuCategory ON tblFeePayment.category_id = tblStuCategory.ID WHERE tblFeePayment.ID = @d1")
            If dbconn.hasException(True) Then Exit Sub
            ' For j As Integer = 0 To dbconn.dt.Rows.Count - 1
            '   For i As Integer = 0 To dbconn.dt.Columns.Count - 1
            MsgBox(dbconn.dt.Rows(0).ItemArray(2))
            '    Next
            '   Next
            If dbconn.dt.Rows.Count > 0 Then
                '  MsgBox(Val(RTrim(dbconn.dt.Rows(0).Item("admission_no"))).ToString)
                cmbAdmissionNo.SelectedValue = Val(RTrim(dbconn.dt.Rows(0).Item("adm")))
                cmbSession.SelectedValue = dbconn.dt.Rows(0).Item("sid")
                cmbClass.SelectedValue = dbconn.dt.Rows(0).Item("cid")
                cmbfeetype.SelectedValue = Val(RTrim(dbconn.dt.Rows(0).Item("feetype_id")))
                cmbFeePart.SelectedValue = Val(RTrim(dbconn.dt.Rows(0).Item("feepart_id")))
                lblName.Text = dbconn.dt.Rows(0).Item("StudentName")
                lblFName.Text = dbconn.dt.Rows(0).Item("FatherName")
                lblClassFee.Text = dbconn.dt.Rows(0).Item("ClassFee")
                lblPaid.Text = dbconn.dt.Rows(0).Item("paidamount")
                lblDueDate.Text = dbconn.dt.Rows(0).Item("paiddate")
                lblCatDiscount.Text = dbconn.dt.Rows(0).Item("CatDiscount")
                lblStuDisc.Text = dbconn.dt.Rows(0).Item("StuDiscount")
                lblPayable.Text = dbconn.dt.Rows(0).Item("payable")
                txtFeeAmount.Text = dbconn.dt.Rows(0).Item("payable")
                dbconn.AddParams("@d1", cmbAdmissionNo.Text)
                dbconn.executequery("Select sum(t.balance) as Balance From
(SELECT tblFeePayment.ID as ReceiptNO  ,admission_no
	  ,payable - paidamount as balance
  FROM tblFeePayment  
  WHERE admission_no = @d1 )t")
                If dbconn.hasException(True) Then Exit Sub
                lblPBalance.Text = dbconn.dt.Rows(0).Item("Balance")
            Else
                MsgBox("Receipt not not found! Try again.")
                Exit Sub
            End If
        End If
    End Sub[/b]
End Class



The txtReceipt_KeyDown sub has this error others working fine.

This post has been edited by nyt1972: 26 January 2019 - 08:35 AM

Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,272
  • Joined: 12-June 08

Re: Column does not belong to table

Posted 26 January 2019 - 08:35 AM

Odd.. that code is different than posted.

Example - one has 'session_ID' and the other has 'sessionID'.
Was This Post Helpful? 0
  • +
  • -

#9 nyt1972   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 04-February 10

Re: Column does not belong to table

Posted 26 January 2019 - 09:32 AM

I attached the whole code along with database script, Error is in FeePayement Module
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,272
  • Joined: 12-June 08

Re: Column does not belong to table

Posted 26 January 2019 - 09:52 AM

Again.. post 7's code is not the same as post 1's code. Are you super duper certain you have the names right?
Was This Post Helpful? 0
  • +
  • -

#11 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,272
  • Joined: 12-June 08

Re: Column does not belong to table

Posted 26 January 2019 - 09:58 AM

If it were me I would put a break point on:

260	            If dbconn.dt.Rows.Count > 0 Then


And check the table in the watch window. I don't know what your currently rolled class/object is doing behind the scenes and I certainly can't debug it as is.
Was This Post Helpful? 0
  • +
  • -

#12 nyt1972   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 04-February 10

Re: Column does not belong to table

Posted 26 January 2019 - 10:23 AM

Its bcoz I am changing the code time by time trying to resolve the issue, thats why may be posted with changed a bit.

but you can check the whole project I attached along with database script.

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#13 nyt1972   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 04-February 10

Re: Column does not belong to table

Posted 27 January 2019 - 10:00 AM

I think I figured out the problem but cannot resolve it, trying to resolve if modi23_1 or other can help.
The problem actually is the combobox values, if other than the value from datatable is selected in the comobobox it does change the combobox value but throw this error.

"Column does not belong to table"

This post has been edited by nyt1972: 27 January 2019 - 10:11 AM

Was This Post Helpful? 0
  • +
  • -

#14 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,272
  • Joined: 12-June 08

Re: Column does not belong to table

Posted 27 January 2019 - 11:31 AM

*shrug* I spent about 30 minutes trying to get your project to load.. it was a rabbit hole of errors and bad references so I moved on.

Not a large fan of your 'sql connection' class or the general UI, but so it goes.
Was This Post Helpful? 0
  • +
  • -

#15 andrewsw   User is offline

  • Stealth IT
  • member icon

Reputation: 6737
  • View blog
  • Posts: 27,741
  • Joined: 12-December 12

Re: Column does not belong to table

Posted 28 January 2019 - 02:14 AM

I am sure there are others, like myself, who have lost track of what is going on, with code changes and a lack of specifics about where the error(s) are occurring (nor intend to download a project).

Post the current, relevant, code to which the most recent error(s) relate; post the current error details, and describe which lines of your posted code relate to the errors.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1