如何使用if statment比较vb.net中的数据库值和字符串值 [英] how to compare the database value and string value in vb.net using if statment
本文介绍了如何使用if statment比较vb.net中的数据库值和字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在数据库记录中如下
Coursename rctpno coursedate coursetimings
AFF 242 24 Nov 14 13.15
我在vb.net中的代码如下
Dim AFF作为字符串
i希望比较来自数据库的abvoe AFF值使用if stamtent from read
for我怎么能用v#在vb.net上做。
问候,
Narasiman P.
In database record as follows
Coursename rctpno coursedate coursetimings
AFF 242 24 Nov 14 13.15
My code as follows in vb.net
Dim AFF as string
i want to compare the abvoe AFF value from database using if stamtent from the read
for that how can i do in vb.net using C#.
Regards,
Narasiman P.
推荐答案
获取数据库表的值并将它们放入DataTable。
现在用你的字符串值检查DataTable行,列值在If条件下。
Took the value of the database table and put those into a DataTable.
Now check the DataTable row, column value with your string value in If condition.
If dt.Rows(0)(1).ToString() = "Your data"
//your code
Else
// your code
End If
这篇关于如何使用if statment比较vb.net中的数据库值和字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文