Private Sub DataGrid1_Click()End SubPrivate Sub Form_Load()
Dim i As Integer
'装入一级类目
Combospecialty.AddItem "全部"
MyClass.Load_by_Upper (0)
i = 0
Do While Arr_ClassName(i) <> ""
Combospecialty.AddItem Arr_ClassName(i)
i = i + 1
Loop
Combospecialty.ListIndex = 0
'不显示二级类目
Comboclass.Visible = False
Combofour.ListIndex = 0
End Sub
Private Sub Refresh_culture()
Dim TmpSource As String
TmpSource = "SELECT S.Student_Id as 学生序号,S.Student_Name as 姓名,S.BadgeID as 学号, " _
+ " C1.Class_Name as 专业名称,C2.class_name as 班级名称,convert(char,F.Student_Grade) as 学年,F.yearinput as 年度," _
+ "F.Cet_Four as 四级成绩, F.Cet_Six as 六级成绩, F.NationPC_Two as 全国计算机二级成绩, " _
+ "F.NationPC_Three as 全国计算机三级成绩, F.NationPC_Four as 全国计算机四级成绩, F.JsPC_Two as 江苏计算机二级成绩," _
+ "F.JsPC_Three as 江苏计算机三级成绩,F.Basicjudge_Type as 基本素质测评类型,F.Basicjudge_Score as 基本素质测评分,F.grow_score as 发展素质分," _
+ "F.Culture_Memo as 文化备注 " _
+ "FROM Students S,Classes C1,classes C2 ,Student_four F" _
+ " WHERE S.Class_Id = C2.Class_Id And S.student_ID=f.student_ID and C2.UpperId =C1.class_ID And S.Student_Id = F.Student_Id "
If Combospecialty.ListIndex <> 0 Then
If Comboclass.ListIndex = 0 Then
TmpSource = TmpSource + " and C1.class_name='" + Trim(Combospecialty.Text) + "'"
Else
TmpSource = TmpSource + " and C1.class_name='" + Trim(Combospecialty.Text) _
+ "' and C2.class_name='" + Trim(Comboclass.Text) + "'"
End If
End If
TmpSource = TmpSource + " and cast(F.Student_Grade as char)='" + Trim(Combofour.Text) + "'"
TmpSource = TmpSource + " order by s.student_ID asc"
Adodc1.RecordSource = TmpSource
Adodc1.Refresh
DataGrid1.Refresh
If Adodc1.Recordset.EOF = True Then
'MsgBox "没有数据可供导出!"
Command1.Enabled = False
Else
Command1.Enabled = True
End If
End Sub
把vb的代码改写成c#的代码
Dim i As Integer
'装入一级类目
Combospecialty.AddItem "全部"
MyClass.Load_by_Upper (0)
i = 0
Do While Arr_ClassName(i) <> ""
Combospecialty.AddItem Arr_ClassName(i)
i = i + 1
Loop
Combospecialty.ListIndex = 0
'不显示二级类目
Comboclass.Visible = False
Combofour.ListIndex = 0
End Sub
Private Sub Refresh_culture()
Dim TmpSource As String
TmpSource = "SELECT S.Student_Id as 学生序号,S.Student_Name as 姓名,S.BadgeID as 学号, " _
+ " C1.Class_Name as 专业名称,C2.class_name as 班级名称,convert(char,F.Student_Grade) as 学年,F.yearinput as 年度," _
+ "F.Cet_Four as 四级成绩, F.Cet_Six as 六级成绩, F.NationPC_Two as 全国计算机二级成绩, " _
+ "F.NationPC_Three as 全国计算机三级成绩, F.NationPC_Four as 全国计算机四级成绩, F.JsPC_Two as 江苏计算机二级成绩," _
+ "F.JsPC_Three as 江苏计算机三级成绩,F.Basicjudge_Type as 基本素质测评类型,F.Basicjudge_Score as 基本素质测评分,F.grow_score as 发展素质分," _
+ "F.Culture_Memo as 文化备注 " _
+ "FROM Students S,Classes C1,classes C2 ,Student_four F" _
+ " WHERE S.Class_Id = C2.Class_Id And S.student_ID=f.student_ID and C2.UpperId =C1.class_ID And S.Student_Id = F.Student_Id "
If Combospecialty.ListIndex <> 0 Then
If Comboclass.ListIndex = 0 Then
TmpSource = TmpSource + " and C1.class_name='" + Trim(Combospecialty.Text) + "'"
Else
TmpSource = TmpSource + " and C1.class_name='" + Trim(Combospecialty.Text) _
+ "' and C2.class_name='" + Trim(Comboclass.Text) + "'"
End If
End If
TmpSource = TmpSource + " and cast(F.Student_Grade as char)='" + Trim(Combofour.Text) + "'"
TmpSource = TmpSource + " order by s.student_ID asc"
Adodc1.RecordSource = TmpSource
Adodc1.Refresh
DataGrid1.Refresh
If Adodc1.Recordset.EOF = True Then
'MsgBox "没有数据可供导出!"
Command1.Enabled = False
Else
Command1.Enabled = True
End If
End Sub
把vb的代码改写成c#的代码
也不要做用A语言代码直接调用B语言代码库这样复杂、这样容易出错的傻事。
只需让A、B语言代码的输入输出重定向到文本文件,或修改A、B语言代码让其通过文本文件输入输出。
即可很方便地让A、B两种语言之间协调工作。
比如:
A将请求数据写到文件a.txt,写完后改名为aa.txt
B发现aa.txt存在时,读取其内容,调用相应功能,将结果写到文件b.txt,写完后删除aa.txt,改名为bb.txt
A发现bb.txt存在时,读取其内容,读完后删除bb.txt
以上A可以替换为任何一种开发语言或开发环境,B可以替换为任何一种与A不同的开发语言或开发环境。
除非A或B不支持判断文件是否存在、文件读写和文件更名。
但是谁又能举出不支持判断文件是否存在、文件读写和文件更名的开发语言或开发环境呢?
可以将临时文件放在RamDisk上提高效率减少磨损磁盘。
数据的结构很复杂的话,文本文件的格式问题可参考json或xml共享临时文本文件这种进程之间的通讯方法相比其它方法的优点有很多,下面仅列出我现在能想到的:
·进程之间松耦合
·进程可在同一台机器上,也可跨机,跨操作系统,跨硬件平台,甚至跨国。
·方便调试和监视,只需让第三方或人工查看该临时文本文件即可。
·方便在线开关服务,只需删除或创建该临时文本文件即可。
·方便实现分布式和负载均衡。
·方便队列化提供服务,而且几乎不可能发生队列满的情况(除非硬盘空间满)
·……“跨语言、跨机,跨操作系统,跨硬件平台,跨国,跨*.*的”苦海无边,
回头是“使用共享纯文本文件进行信息交流”的岸!