VB.net 数据类型错误中的 SQL DataRetrival [英] SQL DataRetrival in VB.net Datatypes Error

查看:24
本文介绍了VB.net 数据类型错误中的 SQL DataRetrival的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SQL 查询从 excelsheet 获取值以绑定到 datagridview 但我的问题是 excelsheet 列包含不同类型的数据然后当我使用 sql 查询时它只显示特定数据,如 long 、 double 或 string

I'm Using SQL queries to get value from excelsheet to bind in datagridview but my problem is the excelsheet column contains different types of data then when i use sql query it only show specific data like long , double or string

Excelsheet 列内容

Excelsheet column content

col1  col2
1     1209
2     1802
3     18nR
4     Uy61
5     1298 

col1 加载正常,但在第 2 列第 3 和第 4 个单元格显示为空我不明白是什么问题,也许 sql 将列定义为整数比这里可能的解决方案是什么(实际列包含大数据这里的表是一个例子来清除问题)

col1 loaded fine but in column 2 3rd and 4th cells shows empty I can't get what's the problem perhaps sql defining the column as integer Than Whats the possible solution Here(Actual column contains big data Here's table is an example to clearify question)

推荐答案

connection = New System.Data.OleDb.OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0 ;Data Source=" & Filepath & " ;Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'")

这篇关于VB.net 数据类型错误中的 SQL DataRetrival的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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