通过vb.net从msaccess检索Max Valure [英] Retriving Max Valure from msaccess through vb.net

查看:74
本文介绍了通过vb.net从msaccess检索Max Valure的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

here s my code

x = New OleDbConnection()
       y = New OleDbCommand()
       x.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\tyres\Database1.accdb;Jet OLEDB:Database Password=raju91831"
       x.Open()
       y.Connection = x
       y.CommandText = "select MAX(No) from Table1 "
       z = y.ExecuteReader()
       While z.Read()
           TextBox1.Text = z.GetInt32(0)
       End While




我收到类似指定的转换无效"之类的错误.




I''m gettting an error like " Specified Cast is Not Valid"

推荐答案

Table1中的否"列是否真的是一个数字-还是某种文本类型?
您也可以在VB代码中获取类型:
Is the column "No" in Table1 really a number - or is it some textual type?
You can get the type also in your VB code:
Type t = z.GetFieldType(0)


这篇关于通过vb.net从msaccess检索Max Valure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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