|
-
Dec 15th, 2003, 11:09 PM
#1
Thread Starter
Junior Member
[Resolved] error in combo box contorl
I found whats wrong with my code.
I'd created a combo box which link with a dataset to let user to select the school name. It works fine in my development PC, but it generate an "unhandled exception error" when run it in the client PC.
Any idea?
Regards,
Calvin
Following is my code:
Private Sub myFrm_Load (........
Dim myCombo as new ComboBox
Dim myDataSet as new DataSet
Get_SchoolCode(myDataSet, myCombo)
.......
End Sub
Public Sub Get_SchoolCode(ByRef ds_school As DataSet, ByRef myControl As ComboBox)
Dim tmpSQL As String
If sys_user.school.Trim = "" Then
tmpSQL = "select sn_code, sn_shortcode, sn_chn_name, sn_eng_name, sn_accode from sn"
Else
tmpSQL = "select sn_code, sn_shortcode, sn_chn_name, sn_eng_name, sn_accode from sn " _
& "where sn_code = '" & sys_user.school & "'"
End If
Dim daTmp As New SqlClient.SqlDataAdapter(tmpSQL, DB_connection)
daTmp.FillSchema(ds_school, SchemaType.Source, "sn")
daTmp.Fill(ds_school, "sn")
With myControl
.DataSource = ds_school.Tables("sn")
If sys_parameters.language = LNG_ENG Then
.DisplayMember = "sn_eng_name"
Else
.DisplayMember = "sn_chn_name"
End If
.ValueMember = "sn_code"
End With
End Sub
Last edited by yellowcat; Dec 15th, 2003 at 11:21 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|