Can someone tell me how to make a attendance form in visual studio using visual basic which stores data in database | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can someone tell me how to make a attendance form in visual studio using visual basic which stores data in database

please give answer according to the school management system as soon as possible

28th May 2017, 10:30 AM
Muhammad Ausaf Ali Gillani
Muhammad Ausaf Ali Gillani - avatar
3 Answers
+ 2
Now, you want to define a function (or just write the code inside a button_click event: For each box as GroupBox in form1.controls For each button as RadioButton in box.controls if box.checked then Tilkobling.open() insert = "INSERT INTO attendance" insert = insert & "(Student_attendance)" insert = insert & "VALUES" insert &= "('" & button.Tag & "')" Dim insertResult as New MySqlCommand(insert, connection) Dim daResult as new MySqlDataAdapter Dim resultTable as new DataTable daResult.SelectCommand = insertResult daResult.Fill(resultTable) connection.close() End if Next Next (2 / 2)
29th May 2017, 12:03 PM
Roolin
Roolin - avatar
+ 2
Alright. Since I don't know how much knowledge you have regarding vb.net and sql, I'll assume you know basic vba and sql syntax (and that you are using mySQL). First, you need to import mySQL: In the top of your program, you the imports method to import the sql-library; imports MySql.Data.NySqlClient Inside the Form-class, you need to define a few variables: Public connection as new MySqlConnection Public connstring as string Public insert as string In the form_load-class, you will need to establish a connection: connection = new MySqlConnection("Server=Servernamehere; Database=databasenamehere;Uid=usernamehere;Pwd=passwordhere) /*Tells the program all the info that it needs to log into the database. If you are wondering what your Uid is, try to use the same name as the database, and vice versa.*/ For this part, you'll need to know which table you are pushing the data into. Since i don't know, i'll assume the following: -That the table's name is "attendence" -That the table consists of "Student_Id, Student_name, Student_attendance" (Not a table that should be used irl, but I'll use it for the sake of simplifying the example) -That you are using radiobuttons to either check for "here" or "not here", and that the radiobuttons has tags with the same value as their name. -That every radiobutton is inside a groupBox. -The form's name is Form1 (1 / 2)
29th May 2017, 12:03 PM
Roolin
Roolin - avatar
+ 1
database is made in Microsoft access and is connected with visual studio I want to make a form which will store attendance in database language is visual basic
29th May 2017, 11:23 AM
Muhammad Ausaf Ali Gillani
Muhammad Ausaf Ali Gillani - avatar