Wednesday 15 September 2010

sql server - binding muliple data from sql to label by choosing item in combobox -


How do I get multiple data from SQL if I select an item in the combo box which is from SQL This is my code :

  private sub Simsiosisacleted Indiks (changing systems as the sender. object, by Val a's system. Aventargs) is Simbo course handles. CMBO course if selected index. Text = "advanced computer technology" in call () Alseef CMBO course. Text = "AUTOELECTRICITY" Then callme () elseif cmboCourse.Text = "automotive" Then callme () End If End Sub Private Sub callme () string as Dim str = ( "Data Source = PC1; User ID = sa ; password = pwd; Databasfriend ") dim con new SqlConnection (STR) as dim Strl choose from" tbl_course as = as the string * course "" new SqlDataAdapter (str1, con) DataSet1 dim new dataset () da LBL   

and this is my table

  CourseGord course ATAC Advanced Mputer (Department Course) Technikan AE AutoElectricity AM Automotive   

It binds only one data, I bind the course_code label of automotive to any specific column example and automotive into a course combo box Choose want to force some data, I add the same label Korskod how to choose AUTOELECTRICITY Autioielarsititi

this test is not Has been done, tell me whether this' does not work.

  private sub cmboCourse_SelectedIndexChanged (ByVal as the System.Object, ByVal e System.EventArgs) as handle cmboCourse.SelectedIndexChanged callme (cmboCourse.Text) End Sub Private Sub callme (ByVal course String as defined) Dim String String = ("Data Source = PC1; User ID = Sa; Password = pwd; Databasfriend") Select the thief named New SqlConnection (STR) as the str1 string as "Select" * Dbl from the Tbl_course [Course] = '& & amp; curriculum & amp; # 39; & # 39; & # 39; & # 39; & # 39; & # 39; as dormant new SqlDataAdapter (str1, thief) DataSet1 slow New datasets () da.Fill (DataSet1, "tbl_course") 'lbl.DataBindings.Add ( "text", DataSet1, "course.Course_Code") so dataset1.Tables ( "tbl_course"). Rows.Count & (0) ("Coursecod") Els MSBBC "Course [" & amp; Course and "] Not Found" End if End   / Pre> 

Please enter the code D. Fill (Dataset 1, "Course") You specify the table as 'Course', while the selection statement selects from the 'tbl_course' table, I'm assuming the name is later correct.

Edit 1:

Bug Fix

Edit 2:

Debugging

No comments:

Post a Comment