回 帖 发 新 帖 刷新版面

主题:求助啊,各位老师不吝指教哦

大家帮我看看,这个将堆垛机的库位坐标转化成列、层的程序对不对噢,如果相应库位有货物就在MSHflexgrid对应位置显示一张图片

数据库表(warehousestockdetail)

ID WarePosCode MaterielCode Materielnum

11     pos133      cs                   1

 

ID WarePosCode materielcode
1 pos102 12456 pos102 第二层第一列
2 pos103 cs pos103 第三层第一列
3 pos106 cs pos106 第一层第一列(每五个库位为一列)
Public Sub qianzhuobiao()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim connstr As String
Dim sql As String
Dim row As Integer
Dim col As Integer
Dim pos As String
connstr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID =sa;Initial Catalog=PT_AS_DB;Data Source=ouyang-c19a8722."
conn.ConnectionString = connstr
conn.Open connstr
rs.CursorLocation = adUseClient
sql = "select * from WarehouseStockDetail "
rs.Open sql, conn, adOpenDynamic, adLockPessimistic '连接数据库
pos = rs.Fields(1)
i = Val(Right$(pos, 3))
If i >= 101 And i <= 150 Then
For i = 101 To 150
x = i \ 5
y = i Mod 5
If x = 20 And y = 1 Then row = 1: col = 1
If x = 20 And y = 2 Then row = 2: col = 1
If x = 20 And y = 3 Then row = 3: col = 1
If x = 20 And y = 4 Then row = 4: col = 1
If x = 21 And y = 0 Then row = 5: col = 1

If x = 21 And y = 1 Then row = 1: col = 2
If x = 21 And y = 2 Then row = 2: col = 2
If x = 21 And y = 3 Then row = 3: col = 2
If x = 21 And y = 4 Then row = 4: col = 2
If x = 22 And y = 0 Then row = 5: col = 2
下面是将在mshflexgrid上显示图片代码,
If rs.RecordCount > 0 Then
rs.MoveFirst
rs.MoveLast
For i = 1 To rs.RecordCount
qianzhuobiao
MSHFlexGrid1.row = 6 - row
MSHFlexGrid1.col = col

If rs.Fields(2) = "cs" Then Set MSHFlexGrid1.CellPicture = LoadPicture("D:\VB工程\工程2\res\面包.jpg")
rs.MoveFirst
rs.MoveNext
rs.MoveLast
Next i
End If
End Sub
帮我看看红色代码应该怎么改了

回复列表 (共4个回复)

沙发

红色代码不需要改。

板凳

路过看看。。。






[url=http://www.176buding.com]背包透明补丁下载[/url]

3 楼

飘过。。。。。

4 楼

支持楼主!虽然我不懂啊· --------------------------------------Jordan putfew people know that is the [url=http://www.retrojordansnew.com/air-jordan-5-retro-c-24.html]jordan retro 5[/url] ,[url=http://www.retrojordansnew.com/air-jordan-4-retro-c-23.html]jordan retro 4[/url] , [url=http://www.retrojordansnew.com/air-jordan-6-retro-c-1.html]jordan retro 6[/url] , [url=http://www.retrojordansnew.com/air-jordan-7-retro-c-2.html]jordan retro 7[/url] , [url=http://www.retrojordansnew.com/air-jordan-8-retro-c-35.html]jordan retro 8[/url] , [url=http://www.retrojordansnew.com/air-jordan-9-retro-c-25.html]jordan retro 9[/url] , [url=http://www.retrojordansnew.com/air-jordan-11-retro-c-16.html]jordan retro 11[/url] , [url=http://www.retrojordansnew.com/air-jordan-13-retro-c-17.html]jordan retro 13[/url]

我来回复

您尚未登录,请登录后再回复。点此登录或注册