还是数据库的问题

hannah80 2003-08-19 06:00:57
Public Function GetCarInfo(ByVal ID As String) As String
Dim sql As String
sql = "select * from 车辆 where kh_ID=" & ID
Dim rs As SqlDataReader
rs = SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("DSN"), CommandType.Text, sql)
If rs.Read Then
mintID = rs("kh_id")
mintCarID = rs("车牌号码")
mstrCarModel = rs("cx_id")
enf if
从表“车辆”里读取出来的“cx_id”是整数型的数据。我要从另一个表“车型”里读取出来的“cx_id”是字符型数据。他们分别有字段“cx_id”,我该怎样写代码?怎样通过共有的字段“cx_id”从“车型”表里读取字符型的数据。
...全文
25 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
txlicenhe 2003-08-19
  • 打赏
  • 举报
回复
Select * from 车型 a join 车辆 b on a.cx_id = convert(varchar,b.cx_id)
lifeforu 2003-08-19
  • 打赏
  • 举报
回复
select a.*,b.* from 车辆 a,车型 b where a.cx_id=cast(b.cx_id as int) and kh_id=...

34,588

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧