使用vb.net从Windows mboile中的sql获取数据 [英] getting data's from sql in windows mboile using vb.net
问题描述
大家好,我已经创建了小型移动应用程序,在我的mobiel应用程序中,我有连接类文件,在该文件中,我正在将应用程序连接到数据库和
执行插入查询,我正在使用sqlcedatareader从sql检索数据,现在我在sqlcedatareader中有我的数据集合
我如何从sqlcedatareader将数据分配给我的文本框控件
请注意,我的sqlcedatareader位于类文件中,文本框控件的格式为
hi all i have created small mobile application, in my mobiel application i have connection class file where i am connecting to my application to database and
excuting insert query, i am reteriving data''s from sql using sqlcedatareader,now i have my collection of data''s in sqlcedatareader
how i ll assign the data''s to my text box control from the sqlcedatareader
note my sqlcedatareader is in class file, text box control in form
推荐答案
取决于连接类文件如何返回该数据.
就文本框而言,这与众不同:
Depends on how the connection class file returns that data.
As far as the text box is concerned , it is nothing out of the ordinary:
myTextBox.Text = stringFromSomewhere
如果您的类文件返回了SqlDataReader(这将是一个很糟糕的主意-应该将它们处理掉,并且通常在需要时调用Dispose是创建者的责任),则只需访问它并移动它即可:
If your class file is returning the SqlDataReader (and that would be a reasonably bad idea - they should be disposed, and it is normally the responsibility of the creator to call Dispose when needed) then just access that and move it:
If reader.Read() Then
Dim desc As String = DirectCast(reader("description"), String)
myTextBox.Text = desc
End If
如果没有,那么我们需要知道它的作用返回以给您更详细的答案.
If it doesn''t, then we would need to know what it does return to give you a more detailed answer.
这篇关于使用vb.net从Windows mboile中的sql获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!