-
-
Save anonymous/bbf8688d1c5eb1e53fb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
using MySql.Data.MySqlClient; | |
namespace Time_Sheet | |
{ | |
public partial class Form2 : Form | |
{ | |
public Form2() | |
{ | |
InitializeComponent(); | |
Fillcombo(); | |
} | |
void Fillcombo() | |
{ | |
string constring = "datasource=localhost;port=3306;username=root;password=root"; | |
string Query = "select * from timesheet.activities ;"; | |
MySqlConnection conDataBase = new MySqlConnection(constring); | |
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase); | |
MySqlDataReader myReader; | |
try | |
{ | |
conDataBase.Open(); | |
myReader = cmdDataBase.ExecuteReader(); | |
while (myReader.Read()) | |
{ | |
string sActivity = myReader.GetString("activity"); | |
activity_box.Items.Add(sActivity); | |
} | |
} | |
catch (Exception ex) | |
{ | |
MessageBox.Show(ex.Message); | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment