错误:-在该列中找不到数据 [英] error:- no data found in the column

查看:91
本文介绍了错误:-在该列中找不到数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim no
no = InputBox("Enter bill number form number", "Search")
cmd = New OleDbCommand("select * from maintain_detail where bill_no=" & no, con)
tempdt = New DataTable
dr = cmd.ExecuteReader
tempdt.Load(dr)
dgmaintain.DataSource = tempdt
dgmaintain.Columns(0).Visible = False
cmd = New OleDbCommand("select * from maintain_master where bill_no=" & no, con)
dt = New DataTable
dr = cmd.ExecuteReader
dt.Load(dr)
If dt.Rows.Count > 0 Then
  txtmbill_no.Text = dt.Rows(0)(0)
  cmbcomp_no.Text = dt.Rows(0)(1)
  mdatepicker.Value = dt.Rows(0)(2)
  cmbmpay_mode.Text = dt.Rows(0)(3)
  txtemp_no.Text = dt.Rows(0)(4)
  txttot_amt.Text = dt.Rows(0)(5)
  txtmtax.Text = dt.Rows(0)(6)
  txtgrand_tot.Text = dt.Rows(0)(7)
  cmd1 = New OleDbCommand("select cust_no from complaint_master where com_form_no=" & Val(cmbcomp_no.Text) & "", con)
  no = cmd1.ExecuteScalar
  txtmcust_no.Text = no
  cmd1 = New OleDbCommand("select cust_name from cust_master where cust_no=" & no & "", con)
  tempdt = New DataTable
  dr = cmd1.ExecuteReader
  tempdt.Load(dr)
  If tempdt.Rows.Count > 0 Then
    txtmcust_name.Text = tempdt.Rows(0)(0)
  End If
  cmd1 = New OleDbCommand("select emp_name from emp_master where emp_no=" & Val(txtemp_no.Text) & "", con)
  tempdt = New DataTable
  dr = cmd1.ExecuteReader
  tempdt.Load(dr)
  If tempdt.Rows.Count > 0 Then
    cmbemp_name.Text = tempdt.Rows(0)(0)
  End If
Else
  MessageBox.Show("No data in table with this bill number")
End If
End Sub


我在第2列收到错误.


I get the error at column 2.

推荐答案

错误:-在列中找不到数据"
如果查看代码,则直接将值分配给控件.可能是这样的情况,当您尝试设置日期值(以日期格式期望)时,它是从数据库传递的空字符串-因此出现错误!

尝试使用DEBUGGER,看看是否是这种情况,并相应地进行处理.您需要检查(来自数据库的)列值,看看它是否是要分配的有效值.
"error:- no data found in the column"
If you look at the code, you are directly assigning values to the controls. It might be the case that when you are trying to set the date value (which would be expected in a date format), it''s an empty string passed from database - hence the error!

Try to use DEBUGGER and see if that''s the case and handle it accordingly. You need to have a check on the column value (that came from database), see if it''s a valid value to be assigned or not.


这篇关于错误:-在该列中找不到数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆