字符串错误 [英] String Error

查看:86
本文介绍了字符串错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用我的sql语句分配一个字符串变量,从数据库中填充的listview中获取项目




我收到错误说那&未定义类型''字符串''

和Systems.Windows.Forms.ListViewItems。


我使用索引0因为值I想要在第一栏

(这是数据库中的客户ID)


将mySqlString作为字符串调暗


''定义从数据库中删除的sqlString

mySqlString =" DELETE from Customers WHERE Cust_ID =''" &

ListView.SelectedItems(0)& "''"


-Ivan


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ...奖励它!

解决方案

您正在尝试获取所选项目并将其视为字符串。

" SelectedItems(0)"有一个.value属性或类似的东西暴露

所选项目的文本?


基本上,你正在处理类似值的类型。 />
" Ivan Weiss" < 4 ***** @ optonline.net>在消息中写道

news:OV ************** @ tk2msftngp13.phx.gbl ...

我正在分配一个字符串变量与我的sql语句从数据库填充的列表视图中获取项目

我收到一个错误说&没有为类型''String''和Systems.Windows.Forms.ListViewItems定义。

我使用的索引为0,因为我想要的值在第一列
(它是来自数据库的客户ID)

将mySqlString作为字符串调整

''定义从数据库中删除的sqlString
mySqlString =" DELETE from客户WHERE Cust_ID =''" &
ListView.SelectedItems(0)&通过开发人员索引 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!



Ivan The Terrible?


您需要ListViewItem.Text属性来获取项目文本。


问候 - OHM

Ivan Weiss写道:

我正在用我的sql语句分配一个字符串变量来获取
从数据库填充的列表视图中的项目。

我收到错误说&没有为类型''String''和Systems.Windows.Forms.ListViewItems定义。

我使用的索引为0因为我想要的值是在第一个
列(它是来自数据库的客户ID)

将mySqlString作为字符串调整

''定义从数据库中删除的sqlString
mySqlString =" DELETE from客户WHERE Cust_ID =''" &
ListView.SelectedItems(0)&通过开发人员索引 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!



我觉得伊万很可怕,因为我在寻找这个应用程序时发现了所有的错误

但他们正慢慢得到解决。


我把它改成了listview.text并且摆脱了错误。但是,

如何知道从哪个列中获取文本?我只需要确认

我的id =我的列表视图第一列中的值。


感谢您的帮助,真的很感激!


-Ivan


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!

I am assigning a string variable with my sql statement getting the item
from a listview filled from a database.

I am getting an error saying that & is not defined for types ''String''
and Systems.Windows.Forms.ListViewItems.

I am using an index of 0 because the value I want is in the first column
(it is the customer ID from the database)

Dim mySqlString As String

''Define sqlString that deletes from database
mySqlString = "DELETE from Customers WHERE Cust_ID = ''" &
ListView.SelectedItems(0) & "''"

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!

解决方案

You are trying to take the selected item and treat it as a string. Does
"SelectedItems(0)" have a .value property or something similar that exposes
the text of the selected item?

Essentially, you are treating a type like a value.
"Ivan Weiss" <iv*****@optonline.net> wrote in message
news:OV**************@tk2msftngp13.phx.gbl...

I am assigning a string variable with my sql statement getting the item
from a listview filled from a database.

I am getting an error saying that & is not defined for types ''String''
and Systems.Windows.Forms.ListViewItems.

I am using an index of 0 because the value I want is in the first column
(it is the customer ID from the database)

Dim mySqlString As String

''Define sqlString that deletes from database
mySqlString = "DELETE from Customers WHERE Cust_ID = ''" &
ListView.SelectedItems(0) & "''"

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



Ivan The Terrible ?

You need to you the ''ListViewItem.Text'' property to get the items text.

Regards - OHM

Ivan Weiss wrote:

I am assigning a string variable with my sql statement getting the
item from a listview filled from a database.

I am getting an error saying that & is not defined for types ''String''
and Systems.Windows.Forms.ListViewItems.

I am using an index of 0 because the value I want is in the first
column (it is the customer ID from the database)

Dim mySqlString As String

''Define sqlString that deletes from database
mySqlString = "DELETE from Customers WHERE Cust_ID = ''" &
ListView.SelectedItems(0) & "''"

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



I feel like Ivan the terrible with all of the errors I have been finding
throughout writing this app but they are slowly getting resolved.

I changed it to listview.text and that got rid of the error. However,
how does it know what column to grab text from? I only need to confirm
my id = the value in the first column of my listview.

Thank for your help, it is truly appreciated!

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于字符串错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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