从Access数据库读取值并将其添加到C#字符串变量 [英] Reading value from Access Database and adding it to C# string variable
本文介绍了从Access数据库读取值并将其添加到C#字符串变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
美好的一天人们!
我有这个问题,我无法解决:我有这个问题
Good Day People!
I have this problem, that i can't solve: i have this querry
string QueryString = "SELECT Rel_ID FROM tblID WHERE (SVPartNumber =" + psReleaseID + ")";
我用来从访问数据库中读取,现在的问题是我如何读取数据库中的值并将其添加到我将在程序中稍后使用的字符串变量中?如果你能给我一些示例代码来从一个访问数据库中读取,然后将结果输入到一个字符串变量中以供以后使用,我将非常感激!
which i use to read from an access database, now the question is how do i read the value from the DB and add it to a string variable which i will use later in the program ? If u can give me some example code for reading from an access database and then inputing the result into a string variable to be used later i would be very gratefull!
推荐答案
您需要执行以下操作:
You need to do something like:
string id= row["Rel_ID"].ToString();
请按照以下步骤操作:
从读取Access数据库的OleDbDataReader获取值 [ ^ ]
如何从C#中的Access数据库中获取数据 [ ^ ]
这里有很多关于Access数据库查询的例子:
从C#查询访问数据库 [ ^ ]
Here you will find many examples regarding Access database querying :
Query Access databse from C#[^]
这篇关于从Access数据库读取值并将其添加到C#字符串变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文