在解决代码方面需要帮助 [英] need help in solving the code

查看:99
本文介绍了在解决代码方面需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

var = ds.Tables(0).Rows(0)(12)


即时通讯在上述行中出现错误..应用程序自动关闭..我正在尝试获取表的第12列并将其保存在变量"var"中.


i m getting error in the above line..the application getting closed automatically..i am trying to fetch the 12th column of the table and save it in the variable ''var''

推荐答案

要获取第12列的值,应使用11,因为索引始终从0开始.

应用程序崩溃的唯一可能原因是,您正在访问不存在的列.
To fetch the value of 12th column, you should use 11 as the index always starts from 0.

The only possible reason that the application is crashing could be, you are accessing column which does not exists.


放入正确的尝试捕获块以查看实际错误.
将代码段放入Try catch中以捕获异常并阻止应用程序直接关闭.

列/行索引始终从DataSet表中的0开始
Put the Proper Try Catch block to see the actual error.
put the section of code into the Try catch for catching the exception and preventing application to close directly.

The column/row index is always start from the 0 in the DataSet table



尝试使用此方法检索第12列的值

Dim d = ds.Tables(0).Rows(0).Item(11)

(或)

Dim d As String = ds.Tables(0).Rows(0)(11)
Hi,
Try this one for retrieving 12th column value

Dim d = ds.Tables(0).Rows(0).Item(11)

(or)

Dim d As String = ds.Tables(0).Rows(0)(11)


这篇关于在解决代码方面需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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