我如何...从SQL数据库VB填充文本框 [英] How do i...fill text boxes from SQL database VB

查看:55
本文介绍了我如何...从SQL数据库VB填充文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从sql数据库填充文本框

如果是intZero> 0然后

'填充支付屏幕

txtPatientID.Value = TempRXTable(PatientID)

txtPatientName.Value = TempRXTable(PatientName)

txtDOB.Value = TempRXTable(PatientDOB)



得到错误...类型system.data.datarow的值不能是转换为字符串



我尝试过:



cast,convert .tostring几乎所有知道

Trying to fill text boxes from sql database
If intZero > 0 Then
'Populate Payments Screen
txtPatientID.Value = TempRXTable("PatientID")
txtPatientName.Value = TempRXTable("PatientName")
txtDOB.Value = TempRXTable("PatientDOB")

getting err... the value of type system.data.datarow cannot be converted to string

What I have tried:

cast, convert.tostring just about everything know

推荐答案

你提供的这段代码没什么用...



你可能想要得到特定数据行的单个值。



The piece of code you provided doesn't help much...

You, probably, want to get single value of specific row of datatable.

'this returns a value of PatientDOB - first row  
txtDOB.Value = TempRXTable.AsEnumerable(). _
    Select(Function(x) x.Fields(Of Date)("PatientDOB")). _
    First()


这篇关于我如何...从SQL数据库VB填充文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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