By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,403 Members | 1,359 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,403 IT Pros & Developers. It's quick & easy.

student

P: 1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


Dim objconn As New OleDbConnection("PROVIDER=MICROSOFT.JET.OLEDB.4.0; Data Source=c:\IQRA.mdb")
Dim objda_prog As New OleDbDataAdapter("select distinct program from program", objconn)
Dim objDA_majors As New OleDbDataAdapter("select distinct majors from majors", objconn)
Dim objds_prog As New DataSet
Dim objds_majors As New DataSet
5:
objda_prog.Fill(objds_prog, "program")

objDA_majors.Fill(objds_majors, "majors")


ComboBox1.DataSource = objds_prog.Tables("program")
ComboBox1.DisplayMember = "program"
ComboBox1.ValueMember = "program"

ComboBox2.DataSource = objds_majors.Tables("majors")
ComboBox2.DisplayMember = "majors"
ComboBox2.ValueMember = "majors"


End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim objconn As New OleDbConnection("PROVIDER=MICROSOFT.JET.OLEDB.4.0; Data Source=c:\IQRA.mdb")
Dim objcmd As New OleDbCommand("INSERT into student (name, program, specialization, shift) values ( '" & TextBox2.Text & "', '" & ComboBox1.SelectedValue & "', '" & ComboBox2.SelectedValue & "', '" & ComboBox3.Text & "')", objconn)
Dim OBJDR As OleDbDataReader

objconn.Open()
objcmd.ExecuteNonQuery()
MsgBox("Record Successfully Added")
objconn.Close()




End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Second As New display
Second.Show()

End Sub
Jul 26 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.