C#查询access数据库无结果,
有一张表shorestPaths ,有一个字段PointsPath,是备注类型,里面内容形如“,1,2,3,4,8,14,” ,我写下面的语句去查询返回结果为null,不知道问题出在哪?在Access里面直接查是有结果的,郁闷
count是一个int型数组。
OleDbCommand command = dbconn.CreateCommand();
for (int j = 0; j < count.Length; j++)
{
count[j] = 0;
string id=(j+1).ToString();
command.CommandText = @"SELECT * FROM shorestPaths WHERE (((shorestPaths.[PointsPath]) like '%,"+id+",%'))";
count[j] = command.ExecuteNonQuery();
}
count是一个int型数组。
OleDbCommand command = dbconn.CreateCommand();
for (int j = 0; j < count.Length; j++)
{
count[j] = 0;
string id=(j+1).ToString();
command.CommandText = @"SELECT * FROM shorestPaths WHERE (((shorestPaths.[PointsPath]) like '%,"+id+",%'))";
count[j] = command.ExecuteNonQuery();
}
...全文
相关推荐
C#连接Access数据库演示
下面是一个简单的C#代码示例,展示了如何建立数据库连接、执行SQL查询以及处理结果:```csharpusing System;using System.Data.OleDb;class Program
C#操作ACCESS数据库,MDB文件读写
总的来说,C#操作Access数据库的关键步骤包括:建立连接、创建命令、执行SQL操作和处理结果。了解这些基本操作后,开发者可以根据具体需求编写更复杂的查询,实现数据的读取、插入、更新和删除功能。
C#连接access数据库
**OLE DB**(Object Linking and Embedding Database):一种数据访问技术,允许应用程序访问多种数据源,包括Access数据库。
c#读取ACCESS
总结,C#结合OLE DB提供了一套全面的方法来读取、修改Access数据库。
C#连接access数据库实例
首先,要连接到Access数据库,你需要引入`System.Data.OleDb`命名空间,它包含了处理OLE DB数据提供程序的类。


