public ReceiveManager(MySqlDataReader dataReader,MetroForm _login) { InitializeComponent(); login = _login; this.FormClosing += ReceiveManager_FormClosing; worker_id = dataReader.GetString("worker_name"); this.Text = "欢迎回来," + dataReader.GetString("worker_name"); dataReader.Close(); DataGridViewButtonColumn request_column = new DataGridViewButtonColumn(); request_column.HeaderText = "请求"; //gigUrlColumn.Name = "Gig Url name"; request_column.Text = "确认"; request_column.UseColumnTextForButtonValue = true; request_column.Width = 106; WaitToConfrimDataGridView.Columns.Add(request_column); WaitToConfrimDataGridView.DataSource = FillDataGrid(); DataGridViewButtonColumn request2_column = new DataGridViewButtonColumn(); request2_column.HeaderText = "请求"; //gigUrlColumn.Name = "Gig Url name"; request2_column.Text = "接货成功"; request2_column.UseColumnTextForButtonValue = true; request2_column.Width = 106; CheckGridView.Columns.Add(request2_column); CheckGridView.DataSource = FillCheckData(); }
private void printForumPost() { String connString = System.Configuration.ConfigurationManager.ConnectionStrings["CredditConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); queryStr = ""; queryStr = "SELECT * FROM forum WHERE forumId='" + forumId + "'"; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, conn); reader = cmd.ExecuteReader(); String post = ""; String name = ""; int accountID = 0; String dateTime = ""; String accountType = ""; while (reader.HasRows && reader.Read()) { post = reader.GetString(reader.GetOrdinal("post")); name = reader.GetString(reader.GetOrdinal("name")); dateTime = reader.GetString(reader.GetOrdinal("dateTime")); accountID = Int32.Parse(reader.GetString(reader.GetOrdinal("accountId"))); accountType = reader.GetString(reader.GetOrdinal("accountType")); } PostLabel.Text = post; NameLabel.Text = name; datetimeLabel.Text = dateTime; TypeLabel.Text = accountType; reader.Close(); conn.Close(); }
public Values getValues(int id) { Values v = new Values(); MySql.Data.MySqlClient.MySqlDataReader mySQLReader = null; string sqlString = $"SELECT * FROM products WHERE id ={id}"; MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn); mySQLReader = cmd.ExecuteReader(); if (mySQLReader.Read()) { v.id = mySQLReader.GetInt32(0); v.productName = mySQLReader.GetString(1); v.productCategory = mySQLReader.GetString(2); v.productDescription = mySQLReader.GetString(3); v.productImage = mySQLReader.GetString(4); return(v); } else { return(null); } }
public bool Login(string email, string password) { int count = DbConnecter.instance.Count("age", "member", "email = '" + email + "' AND password = '******';"); if (count == 0) { return(false); } else { string sql = "SELECT * FROM member WHERE email = '" + email + "' AND password = '******';"; MySql.Data.MySqlClient.MySqlDataReader reader = DbConnecter.instance.Reader(sql); reader.Read(); member.email = email; member.password = password; member.gender = reader.GetInt32(2); member.age = reader.GetInt32(3); member.child = reader.GetInt32(4); member.productBookmarks = ""; if (reader.IsDBNull(5) == false) { member.productBookmarks = reader.GetString(5); } member.ingredientBookmarks = ""; if (reader.IsDBNull(6) == false) { member.ingredientBookmarks = reader.GetString(6); } reader.Close(); DbConnecter.instance.CloseConnection(); return(true); } }
protected void Page_Load(object sender, EventArgs e) { nid = Request.QueryString["news_id"]; try { con.Open(); cmd = new MySqlCommand("select * from news where newsid='" + nid + "'", con); dr = cmd.ExecuteReader(); if (dr.Read()) { article.Text = "<h1 style='font-size:25px'>" + dr.GetString("headline").Substring(0, 1).ToUpper() + dr.GetString("headline").Substring(1).ToLower() + "</h1><br/><br/><img alt='' src='../images/tag.png' /> Alumni News<br/><br/>"; article.Text += " <p style='text-align: justify;'>" + dr.GetString("story") + "</p>"; article.Text += "<p style='text-align: justify;'><a href='http://alumni.ssn.edu.in/alumni-stories.php'>http://alumni.ssn.edu.in/alumni-stories.php</a></p>"; dr.Close(); con.Close(); } else { rerr.Visible = true; } } catch (Exception ex) { CreateLogFile log = new CreateLogFile(); log.ErrorLog(Server.MapPath("../Logs/Errorlog"), "Page load method of NewsRead page for " + Session["loginname"] + ":" + ex.Message); } }
public List<Sector> LoadSector() { try { using (MySqlConnection cn = new MySqlConnection((clsCon = new Connection(this.user)).Parameters())) { listSec = new List<Sector>(); cn.Open(); sql = "select * from asada.view_sectores"; cmd = new MySqlCommand(sql, cn); reader = cmd.ExecuteReader(); while (reader.Read()) { sec = new Sector(); sec.Code = reader.GetString(0); sec.Consecutive = reader.GetInt32(1); sec.Description = reader.GetString(2); listSec.Add(sec); } reader.Close(); return listSec; } } catch (Exception e) { Logs lg = new Logs(); lg.Log(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + ", " + e.Message.ToString()); throw; } }
public LoginCode CheckLogin(string username, string password) { string tusername = "", tpassword = ""; string sql = "SELECT * from user where user='******'"; MySqlCommand cmd = new MySqlCommand(sql, this.myCon); myCon.Open(); myRead = cmd.ExecuteReader(); myCon.Close(); while (myRead.Read()) { tusername = myRead.GetString("username"); tpassword = myRead.GetString("password"); } if (tusername != null) { if (tpassword == password) { return LoginCode.LOGIN_SUCCESS; } } else { } return LoginCode.PASSWORD_INCORRECT; }
private void btnlogin_Click(object sender, EventArgs e) { connection = db.getConnection(); if (connection != null) { command = new MySqlCommand("select * from user_reg where userid='" + textBox1.Text + "'and password='******'", connection); dr = command.ExecuteReader(); if (dr.HasRows) { dr.Read(); role = dr.GetString(3); if (textBox1.Text == dr.GetString(0) && textBox2.Text == dr.GetString(2)) { user = textBox1.Text; home h = new home(); h.Show(); this.Hide(); } else { textBox1.Text = ""; textBox2.Text = ""; MessageBox.Show("Invalid user name or password"); } } else { textBox1.Text = ""; textBox2.Text = ""; MessageBox.Show("Invalid user name or password"); } } }
public List <Person> getPersons() { List <Person> personList = new List <Person>(); MySql.Data.MySqlClient.MySqlDataReader mySqlReader = null; string sqlString = "SELECT * from tbl_personnel"; var cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn); try { mySqlReader = cmd.ExecuteReader(); while (mySqlReader.Read()) { Person p = new Person(); p.ID = mySqlReader.GetInt32(0); p.FirstName = mySqlReader.GetString(1); p.LastName = mySqlReader.GetString(2); p.PayRate = mySqlReader.GetFloat(3); p.StartDate = mySqlReader.GetDateTime(4); p.EndDate = mySqlReader.GetDateTime(5); personList.Add(p); } } catch (Exception ex) { Console.WriteLine("MySQL exception"); Console.WriteLine(ex); Console.WriteLine(ex.Data); } return(personList); }
protected void loadDataToExerciseTable() { thColorStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#d9534f"); trColorSytle.BackColor = System.Drawing.ColorTranslator.FromHtml("#343a40"); try { connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["WebAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connectionString); conn.Open(); String query = "SELECT * FROM webapppersonalfit.trainer"; cmd = new MySql.Data.MySqlClient.MySqlCommand(query, conn); reader = cmd.ExecuteReader(); while (reader.HasRows && reader.Read()) { String trainerID = reader.GetString(reader.GetOrdinal("userID")); String trainerName = reader.GetString(reader.GetOrdinal("name")); String cardTitle = reader.GetString(reader.GetOrdinal("name")); String cardContent = reader.GetString(reader.GetOrdinal("short_intro")); String picUrl = reader.GetString(reader.GetOrdinal("url_pic")); addCardOntoPlaceHolder(trainerID, trainerName, cardTitle, cardContent, picUrl); } reader.Close(); conn.Close(); } catch (Exception e) { //passwordTextBox.Value = e.ToString(); } }
public Entregador(MySqlDataReader rs) { try { int i = 0; while (true) { switch (rs.GetName(i)) { case "cpf": this.cpf = rs.GetString(i); break; case "nome": this.nome = rs.GetString(i); break; case "telefone": if (this.telefone == null) this.telefone = new model.Telefone(); this.telefone.Numero = rs.GetString(i); break; case "placa": this.placa = rs.GetString(i); break; default: throw new Exception("Propriedade não encontrada"); } i++; } } catch { } }
private void DoSQLQuery1() { try { String connString = System.Configuration.ConfigurationManager.ConnectionStrings["WebAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); queryStr = ""; queryStr = "SELECT * FROM database.tbl_user WHERE tbl_user.id='" + Session["Id"] + "' "; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, conn); reader = cmd.ExecuteReader(); while (reader.HasRows && reader.Read()) { education = reader.GetString(reader.GetOrdinal("education")); localisation = reader.GetString(reader.GetOrdinal("localisation")); } if (reader.HasRows) { // Session["uname"] = name; // userName = (String)(Session["utname"]); // Label14.Text = userName; LabelEducation.Text = education; LabelLocation.Text = localisation; } reader.Close(); conn.Close(); } catch (Exception e) { Console.WriteLine(e); } }
protected void Page_Load(object sender, EventArgs e) { try { connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["WebAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connectionString); conn.Open(); userID = (String)Session["trainerID"]; String query = "SELECT * FROM webapppersonalfit.trainer AS T WHERE T.userID=" + userID + ";"; cmd = new MySql.Data.MySqlClient.MySqlCommand(query, conn); reader = cmd.ExecuteReader(); if (reader.HasRows && reader.Read()) { Username.Text = reader.GetString(reader.GetOrdinal("name")); short_intro.Text = reader.GetString(reader.GetOrdinal("short_intro")); long_intro.Text = reader.GetString(reader.GetOrdinal("long_intro")); avatar.ImageUrl = reader.GetString(reader.GetOrdinal("url_pic")); } addSpanOntoPlaceHolder(); conn.Close(); reader.Close(); } catch (Exception ex) { // } }
public List <AmphurModel> getAmphur(int province_id) { MySqlConnection con = WebApiConfig.conn(); MySql.Data.MySqlClient.MySqlDataReader mySQLReader = null; MySqlCommand cm = con.CreateCommand(); cm.CommandText = "SELECT * FROM amphur WHERE PROVINCE_ID =" + province_id.ToString(); try { con.Open(); } catch (MySql.Data.MySqlClient.MySqlException ex) { throw; } mySQLReader = cm.ExecuteReader(); var result = new List <AmphurModel>(); while (mySQLReader.Read()) { AmphurModel p = new AmphurModel(); p.amphur_id = mySQLReader.GetInt32(0); p.amphur_code = mySQLReader.GetString(1); p.amphur_name = mySQLReader.GetString(2); p.geo_id = mySQLReader.GetInt32(3); p.province_id = mySQLReader.GetInt32(4); result.Add(p); } return(result); }
private void LoginWithPasswordHashFunction() { List <String> salthashList = null; List <String> namesList = null; try { connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["WebAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connectionString); conn.Open(); String query = "SELECT slowHashSalt, firstname, middlename, lastname FROM webAppPersonalFit.userregistration WHERE username=?uname"; cmd = new MySql.Data.MySqlClient.MySqlCommand(query, conn); cmd.Parameters.AddWithValue("?uname", usernameTextBox.Text); reader = cmd.ExecuteReader(); while (reader.HasRows && reader.Read()) { if (salthashList == null) { salthashList = new List <String>(); namesList = new List <String>(); } String saltHashes = reader.GetString(reader.GetOrdinal("slowHashSalt")); //Console.WriteLine(saltHashes); salthashList.Add(saltHashes); String fullname = reader.GetString(reader.GetOrdinal("firstname")) + " " + reader.GetString(reader.GetOrdinal("lastname")); namesList.Add(fullname); } if (salthashList != null) { for (int i = 0; i < salthashList.Count; i++) { bool validUser = PasswordStorage.VerifyPassword(passwordTextBox.Text, salthashList[i]); if (validUser == true) { Session["UserName"] = namesList[i]; Response.BufferOutput = true; Response.Redirect("LoggedIn.aspx", false); } else { passwordTextBox.Text = "User not authenticated"; } } } reader.Close(); conn.Close(); } catch (Exception e) { Console.WriteLine(e); } }
//When Login has been Pressed protected void SubmitEventMethod(object sender, EventArgs e) { string username = Username.Text; string pass = Password.Text; query = "SELECT * FROM 17agileteam6db.users WHERE staff_no ='" + username + "' AND pass = '******';"; //checks user name and password DB db = new DB(); reader = db.Select(query); while (reader.HasRows && reader.Read()) { Session["role"] = reader.GetString(reader.GetOrdinal("role")); Session["firstName"] = reader.GetString(reader.GetOrdinal("first_name")); Session["lastName"] = reader.GetString(reader.GetOrdinal("last_name")); } if (reader.HasRows) { Session["loggedin"] = "Loggedin"; Session["StaffNo"] = Username.Text; Response.BufferOutput = true; Response.Redirect("Index.aspx", false); } else { //If username and password not found return false Session["failed"] = "failed"; Response.Redirect("Login.aspx", false); } reader.Close(); }
private void DoSQLQueryBarFournisseur() { try { String connString = System.Configuration.ConfigurationManager.ConnectionStrings["WebAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); queryStr = ""; queryStr = "SELECT * FROM database.detail WHERE detail.t1='" + Session["AnnBarFournisseur"] + "' AND detail.titre='Solde fournisseurs'"; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, conn); reader = cmd.ExecuteReader(); while (reader.HasRows && reader.Read()) { fournisseur = reader.GetString(reader.GetOrdinal("t1")); DebitF = reader.GetString(reader.GetOrdinal("t2")); CreditF = reader.GetString(reader.GetOrdinal("t3")); SoldeF = reader.GetString(reader.GetOrdinal("t4")); } reader.Close(); conn.Close(); } catch (Exception e) { Console.WriteLine(e); } }
//private MySql.Data.MySqlClient.MySqlConnection conn; /*public DepartmentPersistence() * { * string feashConn; * feashConn = "server=localhost;port=3306;database=fea_starhub;username=root;password=135246;"; * try * { * conn = new MySql.Data.MySqlClient.MySqlConnection(); * conn.ConnectionString = feashConn; * conn.Open(); * } * catch (MySql.Data.MySqlClient.MySqlException ex) * { throw ex; } * }*/ public ArrayList allDepts() { MySql.Data.MySqlClient.MySqlConnection conn; string feashConn; feashConn = ConfigurationManager.ConnectionStrings["localDB"].ConnectionString; conn = new MySql.Data.MySqlClient.MySqlConnection(); try { conn.ConnectionString = feashConn; conn.Open(); ArrayList d = new ArrayList(); MySql.Data.MySqlClient.MySqlDataReader getReader = null; string getString = "SELECT * FROM Dept_ProgramID;"; MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(getString, conn); getReader = cmd.ExecuteReader(); while (getReader.Read()) { getSingleDept adept = new getSingleDept(); adept.DName = getReader.IsDBNull(0) == false?getReader.GetString(0) : null; adept.DEntity = getReader.IsDBNull(1) == false?getReader.GetString(1) : null; adept.ProgramID = getReader.IsDBNull(2) == false?getReader.GetString(2) : null; d.Add(adept); } return(d); } catch (MySql.Data.MySqlClient.MySqlException ex) { throw ex; } finally { conn.Close(); } }
protected void LoginUser(object sender, EventArgs e) { string connectionString = @"Data Source=db4free.net; Database=centresportif420; user=centresportif420; password=stephane420;"; using (MySqlConnection cn = new MySqlConnection(connectionString)) { cn.Open(); queryStr = "SELECT * FROM centresportif420.personne WHERE codebarre='" + Server.HtmlEncode(((TextBox)(Login1.FindControl("UserName"))).Text) + "' AND motdepasse='" + Server.HtmlEncode(((TextBox)(Login1.FindControl("Password"))).Text) + "'"; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, cn); reader = cmd.ExecuteReader(); name = ""; while (reader.HasRows && reader.Read()) { name = reader.GetString(reader.GetOrdinal("nom")); role = reader.GetString(reader.GetOrdinal("role")); idpersonne = reader.GetString(reader.GetOrdinal("idpersonne")); Session["idpersonne"] = idpersonne; Session["urole"] = role; } if (reader.HasRows) { Session["uname"] = name; Response.BufferOutput = true; Response.Redirect("~/Account/Membre.aspx", false); FormsAuthentication.SetAuthCookie(Server.HtmlEncode(((TextBox)(Login1.FindControl("UserName"))).Text), true); } else { Response.Redirect("~/Account/Login.aspx", false); } reader.Close(); cn.Close(); } }
public Customer getCustomer(long contactNo) { Customer p = new Customer(); MySqlConnection conn = mysqlDbConnect.GetConnection(); MySql.Data.MySqlClient.MySqlDataReader mySqlReade = null; String sqlString = "SELECT * FROM customer WHERE contactNo = '" + contactNo.ToString() + "'"; MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn); mySqlReade = cmd.ExecuteReader(); if (mySqlReade.Read()) { p.contactNo = mySqlReade.GetInt32(0); p.firstName = mySqlReade.GetString(1); p.lastName = mySqlReade.GetString(2); p.email = mySqlReade.GetString(3); p.address = mySqlReade.GetString(4); p.password = mySqlReade.GetString(5); return(p); } else { return(null); } }
public ArrayList getCustomer() { ArrayList CustomerArray = new ArrayList(); MySqlConnection conn = mysqlDbConnect.GetConnection(); MySql.Data.MySqlClient.MySqlDataReader mySqlReade = null; String sqlString = "SELECT * FROM customer"; MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn); mySqlReade = cmd.ExecuteReader(); while (mySqlReade.Read()) { Customer p = new Customer(); p.contactNo = mySqlReade.GetInt32(0); p.firstName = mySqlReade.GetString(1); p.lastName = mySqlReade.GetString(2); p.email = mySqlReade.GetString(3); p.address = mySqlReade.GetString(4); p.password = mySqlReade.GetString(5); CustomerArray.Add(p); } return(CustomerArray); }
public getSingleDept oneProgID(string als) { MySql.Data.MySqlClient.MySqlConnection conn; string feashConn; feashConn = ConfigurationManager.ConnectionStrings["localDB"].ConnectionString; conn = new MySql.Data.MySqlClient.MySqlConnection(); try { conn.ConnectionString = feashConn; conn.Open(); getSingleDept d = new getSingleDept(); MySql.Data.MySqlClient.MySqlDataReader getReader = null; string getString = "SELECT * FROM Dept_ProgramID WHERE DeptProgramID = '" + als.ToString() + "';"; MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(getString, conn); getReader = cmd.ExecuteReader(); if (getReader.Read()) { d.DName = getReader.IsDBNull(0) == false?getReader.GetString(0) : null; d.DEntity = getReader.IsDBNull(1) == false?getReader.GetString(1) : null; d.ProgramID = getReader.IsDBNull(2) == false?getReader.GetString(2) : null; return(d); } else { return(null); } } catch (MySql.Data.MySqlClient.MySqlException ex) { throw ex; } finally { conn.Close(); } }
public List<Sector> LoadSector() { try { using (MySqlConnection cn = new MySqlConnection((clsCon=new Connection(this.user)).Parameters())) { listSec = new List<Sector>(); cn.Open(); sql = "select * from asada.view_sectores"; cmd = new MySqlCommand(sql, cn); reader = cmd.ExecuteReader(); while (reader.Read()) { sec = new Sector(); sec.Code = reader.GetString(0); sec.Consecutive = reader.GetInt32(1); sec.Description = reader.GetString(2); listSec.Add(sec); } reader.Close(); return listSec; } } catch (Exception) { throw; } }
private void ReviewRecipeData(String recId) { ///Get recipe data from database by recipe id try { CheckStateDB(); String sql_get = "SELECT recipe_name, detail, materialCode FROM recipe WHERE recipe_id = @recipe_id"; cmd = new MySqlCommand(sql_get, conn); cmd.Parameters.AddWithValue("@recipe_id", recId); reader = cmd.ExecuteReader(); while (reader.Read()) { this.recipeName.Text = reader.GetString("recipe_name"); this.recipeDetail.Text = reader.GetString("detail"); this.recipeMaterial.Text = reader.GetString("materialCode"); } reader.Close(); } catch (Exception e) { ErrorLogCreate(e); MessageBox.Show("เกิดข้อผิดพลาด ข้อมูล error บันทึกอยู่ในไฟล์ log กรุณาแจ้งข้อมูลดังกล่าวแก่ทีมติดตั้ง" , "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public Values getValues(int id) { Values v = new Values(); MySql.Data.MySqlClient.MySqlDataReader mySQLReader = null; string sqlString = $"SELECT * FROM Products WHERE id ={id}"; MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn); mySQLReader = cmd.ExecuteReader(); if (mySQLReader.Read()) { v.id = mySQLReader.GetInt32(0); v.product_name = mySQLReader.GetString(1); v.stock_quantity = mySQLReader.GetInt32(2); v.des_box = mySQLReader.GetString(3); v.URL = mySQLReader.GetString(4); v.categories = mySQLReader.GetString(5); return(v); } else { return(null); } }
public static JedinicaMjereDTO readerToJedinicaMjereDTO(MySqlDataReader reader) { JedinicaMjereDTO jedinicaMjere = new JedinicaMjereDTO(); jedinicaMjere.SifraJediniceMjere = reader.GetString("SifraJediniceMjere"); jedinicaMjere.OpisJediniceMjere = reader.GetString("OpisJediniceMjere"); return jedinicaMjere; }
public List<Tarifa> LoadTarifa() { try { using (MySqlConnection cn = new MySqlConnection((clsCon = new Connection(this.user)).Parameters())) { lisTrf = new List<Tarifa>(); cn.Open(); sql = "select * from asada.view_tarifas"; cmd = new MySqlCommand(sql, cn); reader = cmd.ExecuteReader(); while (reader.Read()) { trf = new Tarifa(); trf.Code = reader.GetString(0); trf.FixAmount = float.Parse(reader.GetString(1)); trf.MetAmount = float.Parse(reader.GetString(2)); trf.RateHidrant = float.Parse(reader.GetString(3)); trf.TypeAppString = reader.GetString(4); lisTrf.Add(trf); } reader.Close(); return lisTrf; } } catch (Exception) { throw; } }
private void LoginWithPasswordHashFunction() { List <String> salthashList = null; List <String> namesList = null; try { String connString = System.Configuration.ConfigurationManager.ConnectionStrings["projectConnectionString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); querystr = "SELECT `slowHashSalt`, `first_name`, `last_name`, `user_id` FROM `project`.`client` WHERE username=?uname"; cmd = new MySql.Data.MySqlClient.MySqlCommand(querystr, conn); cmd.Parameters.AddWithValue("?uname", usernametextbox.Text); reader = cmd.ExecuteReader(); while (reader.HasRows && reader.Read()) { if (salthashList == null) { salthashList = new List <String>(); namesList = new List <String>(); } String saltHashes = reader.GetString(reader.GetOrdinal("slowHashSalt")); salthashList.Add(saltHashes); String fullname = reader.GetString(reader.GetOrdinal("first_name")) + " " + reader.GetString(reader.GetOrdinal("last_name")); namesList.Add(fullname); user_id = reader.GetString(reader.GetOrdinal("user_id")); } reader.Close(); //check to see whether the results from the query are empty if (salthashList != null) { for (int i = 0; i < salthashList.Count; i++) { querystr = ""; bool ValidUser = PasswordHash.ValidatePassword(userpasswordtextbox.Text, salthashList[i]); if (ValidUser == true) { Session["uname"] = namesList[i]; Session["user_id"] = user_id; Response.BufferOutput = true; Response.Redirect("LoggedIn.aspx", false); } else { userpasswordtextbox.Text = "User not authenticated"; } } } } catch (Exception ex) { userpasswordtextbox.Text = ex.ToString(); } }
public override void Fill(MySql.Data.MySqlClient.MySqlDataReader dr) { _ID = dr.GetInt32(db_ID); _Abbreviation = dr.GetString(db_Abbreviation); _Name = dr.GetString(db_Name); _EndWeek = dr.GetInt32(db_EndWeek); _StartWeek = dr.GetInt32(db_StartWeek); }
public Pages(MySqlDataReader reader) { this.Id = reader.GetInt32("id"); this.Title = reader.GetString("title"); this.LinkTitle = reader.GetString("linktitle"); this.PageType = reader.GetString("pagetype"); this.Content = reader.GetString("content"); }
private ETerceros mapearObjeto(MySql.Data.MySqlClient.MySqlDataReader fila) { ETerceros tercero = new ETerceros(); tercero.nit = fila.GetString("nit"); tercero.nombre = fila.GetString("nombres"); return(tercero); }
public override void Fill(MySql.Data.MySqlClient.MySqlDataReader dr) { _ID = dr.GetInt32(db_ID); _RoleID = dr.GetInt32(db_RoleID); _Username = dr.GetString(db_Username); _Password = dr.GetString(db_Password); _Salt = dr.GetString(db_Salt); }
protected void Page_Load(object sender, EventArgs e) { if (Session["Id"] == null) Response.Redirect("Logon.aspx"); string Iduser = Convert.ToString(Session["Id"]); Label1.Visible = false; try { conexao = new MySqlConnection("server=localhost; port=3306; user id=root; password=root; database= lojaonline"); conexao.Open(); string sql = "SELECT produtos.*, comprasefetuadas.* from produtos INNER JOIN comprasefetuadas ON produtos.idprod=comprasefetuadas.idproduto WHERE comprasefetuadas.idusuario=@id ORDER BY produtos.nomeprod"; stm = new MySqlCommand(sql, conexao); stm.Parameters.AddWithValue("@id", Iduser); stm.Prepare(); dr = stm.ExecuteReader(); String strHTML = ""; if (dr.HasRows) { //mostramos o cabeçalho da <table> somente se temos registros strHTML = "<TABLE name=produts border=1 width='65%'> <TR style='font-size: 14px; font-family: verdana; text-align: center; font-weight: 900; color: #009;'>" + "<TD> Código </TD><TD style='text-align: left'> Nome </TD>" + "<TD> Preço </TD><TD> Quantidade </TD></TR>"; } else { Label1.Visible = true; Label1.Text = "Este usuário não comprou produtos ainda nesta loja on-line"; } while (dr.Read()) { String codigo = dr.GetString("idprod"); String nome = dr.GetString("nomeprod"); String preco = dr.GetString("preco"); String qtde = dr.GetString("qtdecomprada"); strHTML += "<TR><TD style='font-size: 12px; font-family: verdana; text-align: center;'>" + codigo + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: left;'> " + nome + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: center;'>" + preco + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: center;'>" + qtde + "</TD></TR>"; } strHTML += "</TABLE> <br/><br/><br/>"; LiteralControl lc = new LiteralControl(strHTML); Panel1.Controls.Add(lc); stm.Dispose(); dr.Close(); conexao.Close(); } catch (Exception exc) { Label1.Visible = true; Label1.Text = "Erro no processamento do BD - " + exc.Message; } }
public override void Fill(MySql.Data.MySqlClient.MySqlDataReader dr) { _ID = dr.GetInt32(db_ID); _Name = dr.GetString(db_Name); _Abbreviation = dr.GetString(db_Abbreviation); _RequiresRoom = dr.GetBoolean(db_RequiresRoom); _RequiresDays = dr.GetBoolean(db_RequiresDays); _RequiresTimes = dr.GetBoolean(db_RequiresTimes); }
public override void Fill(MySql.Data.MySqlClient.MySqlDataReader dr) { _ID = dr.GetInt32(db_ID); _FirstName = dr.GetString(db_FirstName); _LastName = dr.GetString(db_LastName); _MiddleName = dr.GetString(db_MiddleName); _Number = dr.GetInt32(db_Number); _CourseLoad = dr.GetInt32(db_CourseLoad); }
private void DoSQLQueryy() { try { String connString = System.Configuration.ConfigurationManager.ConnectionStrings["WebAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); queryStr = ""; queryStr = "SELECT * FROM database.tb WHERE tb.codeuser='******'"; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, conn); reader = cmd.ExecuteReader(); z01 = ""; z02 = ""; z03 = ""; z04 = ""; z05 = ""; z06 = ""; z07 = ""; z08 = ""; z09 = ""; z10 = ""; while (reader.HasRows && reader.Read()) { z01 = reader.GetString(reader.GetOrdinal("z01")); z02 = reader.GetString(reader.GetOrdinal("z02")); z03 = reader.GetString(reader.GetOrdinal("z03")); z04 = reader.GetString(reader.GetOrdinal("z04")); z05 = reader.GetString(reader.GetOrdinal("z05")); z06 = reader.GetString(reader.GetOrdinal("z06")); z07 = reader.GetString(reader.GetOrdinal("z07")); z08 = reader.GetString(reader.GetOrdinal("z08")); z09 = reader.GetString(reader.GetOrdinal("z09")); z10 = reader.GetString(reader.GetOrdinal("z10")); } if (reader.HasRows) { LabelT1.Text = z01; LabelT2.Text = z02; LabelT3.Text = z03; LabelT4.Text = z04; LabelT5.Text = z05; LabelT6.Text = z06; LabelT7.Text = z07; LabelT8.Text = z08; LabelT9.Text = z09; LabelT10.Text = z10; LabelZ04.Text = z04; } reader.Close(); conn.Close(); } catch (Exception e) { Console.WriteLine(e); } }
Message ReadMessage (MySqlDataReader r) { return new Message { Id = new Guid (r.GetString ("Id")), From = r.GetString ("From"), Text = r.GetString ("Text"), Time = r.GetDateTime ("Time"), }; }
public SearchPost Map(MySqlDataReader rdr) { SearchPost SP = new SearchPost(); SP.Url = HttpContext.Current.Request.Url.AbsoluteUri + "/"+ rdr.GetInt32("id"); SP.Id = rdr.GetInt32("id"); SP.Body = rdr.GetString("body"); SP.Title = rdr.GetString("title"); return SP; }
/* * syntheticDetergent = 0, //합성세제 * bleach = 1, //표백제 * softner = 2, //섬유유연제 * freshener = 3, //방향제 * deodorant = 4, //탈취제 * detergent = 5 //세정제 */ public void PanelOn(Category category) { Transform body = transform.GetChild(1); content = body.GetChild(0).GetComponent <RectTransform>(); panelSize = body.GetComponent <RectTransform>().rect.size; string categoryKorean = ""; if (category == Category.syntheticDetergent) { categoryKorean = "합성세제"; } else if (category == Category.bleach) { categoryKorean = "표백제"; } else if (category == Category.softner) { categoryKorean = "섬유유연제"; } else if (category == Category.freshener) { categoryKorean = "방향제"; } else if (category == Category.deodorant) { categoryKorean = "탈취제"; } else if (category == Category.detergent) { categoryKorean = "세정제"; } string sql = "SELECT * FROM product WHERE category = '" + categoryKorean + "';"; int idCount = DbConnecter.instance.Count("id", "product", "category = '" + categoryKorean + "'"); List <ProductUnit> units = AddUnits(idCount); MySql.Data.MySqlClient.MySqlDataReader reader = DbConnecter.instance.Reader(sql); int number = 0; while (reader.Read()) { Product product = new Product(); product.id = reader.GetInt32(0); product.name = reader.GetString(1); product.barcode = reader.GetString(2); product.company = reader.GetString(3); product.ingredients = reader.GetString(5); product.imagePath = reader.GetString(6); product.category = category; units[number].InfoChange(product, gameObject); number++; } reader.Close(); DbConnecter.instance.CloseConnection(); }
private void DoSQLQueryyIm() { try { String connString = System.Configuration.ConfigurationManager.ConnectionStrings["WebAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); String queryStr = ""; queryStr = "SELECT * FROM database.metadata WHERE metadata.codeuser='******' "; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, conn); reader = cmd.ExecuteReader(); // z01 = ""; userName = ""; datee = ""; contentmeta = ""; while (reader.HasRows && reader.Read()) { userName = reader.GetString(reader.GetOrdinal("username")); iduser = reader.GetString(reader.GetOrdinal("iduser")); idmetadata3 = reader.GetInt32(reader.GetOrdinal("id")); datee = reader.GetString(reader.GetOrdinal("date")); contentmeta = reader.GetString(reader.GetOrdinal("content")); } if (reader.HasRows) { // Label3.Text = z01; Image2.ImageUrl = "~/ShowImage.ashx?id=" + iduser; Image3.ImageUrl = "~/ShowMetadata.ashx?codeuser="******"urole"]; Image4.ImageUrl = "~/ShowImage.ashx?id=" + Session["Id"]; LabelProfil.Text = userName; LabelDate.Text = datee; LabelContent.Text = contentmeta; } reader.Close(); String queryStr1 = ""; queryStr1 = "SELECT COUNT(id) as countlike FROM database.like WHERE like.idmetadata='" + idmetadata3 + "' "; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr1, conn); reader = cmd.ExecuteReader(); while (reader.HasRows && reader.Read()) { countlike = reader.GetString(reader.GetOrdinal("countlike")); } LabelLike.Text = countlike; conn.Close(); } catch (Exception e) { Console.WriteLine(e); } }
protected Evenement GetEvenementFromDataReader(MySqlDataReader dataReader) { int evenementId = dataReader.GetInt32("evenement_id"); Lokatie lokatie = (Lokatie)Enum.Parse(typeof(Lokatie), dataReader.GetString("lokatie")); DateTime datum = dataReader.GetDateTime("datum"); string evenementNaam = dataReader.GetString("evenementnaam"); Evenement evenement = new Evenement { ID = evenementId, Datum = datum, Lokatie = lokatie, Naam = evenementNaam }; return evenement; }
protected Expert ProcessRow(Expert expert, MySqlDataReader Reader) { base.ProcessRow(expert, Reader); //expert data expert.Company = Reader.GetString(8); expert.Address = Reader.GetString(9); expert.Postcode = Reader.GetString(10); expert.Telephone = Reader.GetString(11); expert.City = Reader.GetString(12); return expert; }
public static Usuario GetUsuario(MySqlDataReader rdr) { if (rdr.IsDBNull(rdr.GetOrdinal("CODUSU"))) return null; Usuario u = new Usuario(); u.CodUsu = rdr.GetInt32("CODUSU"); u.NomUsu = rdr.GetString("NOMUSU"); u.Login = rdr.GetString("LOGIN"); u.PasswordPropio = rdr.GetString("PASSWORD_PROPIO"); u.NivelAriges = rdr.GetInt32("NIVEL_ARIGES"); return u; }
/// <summary> /// Gets data from SELECT and puts them into CustomerSelectedList /// columns: 0 - name, 1 - surname, 2 - address, 3 -email, 4 - paid /// </summary> /// <param name="iResult"></param> public static void GetSelectedCustomers(MySqlDataReader iResult) { //MySqlDataReader wynik = TworzenieZapytan.WykonajSelecta(iSelect); CustomerActions.ClearSelectedList(); while (iResult.Read()) { Customer p = new Customer(iResult.GetString(0), iResult.GetString(1), iResult.GetString(2), iResult.GetString(3), iResult.GetInt32(4) == 0 ? false : true); CustomerActions.AddToSelectedList(p); } }
internal PlaniData(MySqlDataReader r) { StringBuilder sb = new StringBuilder(); Gala = r.GetUInt16(0); Sys = r.GetUInt16(1); Pla = r.GetUInt16(2); Planityp = r.GetString(3); Objekttyp = r.GetString(4); Ownername = r.GetString(5); Ownerally = r.IsDBNull(6) ? "" : r.GetString(6); Planiname = r.GetString(7); }
public static void OgarnijDanePacjentow(MySqlDataReader wynik) { //MySqlDataReader wynik = TworzenieZapytan.WykonajSelecta(iSelect); AkcjePacjentow.WyczyscListePacjentow(); while (wynik.Read()) { Pacjent p = new Pacjent(AkcjePacjentow.IlePacjentow(), wynik.GetString(0), wynik.GetString(1), wynik.GetString(2), wynik.GetString(3)); AkcjePacjentow.DodajPacjenta(p); } }
public void load(MySql.Data.MySqlClient.MySqlDataReader rds) { while (rds.Read()) { var sii = new ScriptIdInfo(); sii.id_dbid = rds.GetUInt64(0); sii.old_dbid = rds.GetUInt64(1); sii.serverid = rds.GetString(2); sii.old_info = rds.GetString(3); dst.Add(sii); } }
// Haal adres van klanten binnen protected Adres getFullAdresFromDataReader(MySqlDataReader datareader) { Adres adres = new Adres { Id = datareader.GetInt32("adresId"), Straat = datareader.GetString("straat"), Postcode = datareader.GetString("postcode"), Huisnummer = datareader.GetInt32("huisnummer"), HuisnummerToevoegsel = String.IsNullOrEmpty(datareader["huisnummertoevoeging"].ToString()) ? "Geen" : datareader.GetString("huisnummertoevoeging"), Stad = datareader.GetString("stad"), }; return adres; }
public static Champion Mapper(MySqlDataReader r) { var c = new Champion(); c.Id = r.GetInt32("Id"); c.Name = r.GetString("Name"); c.Title = r.GetString("Title"); c.Stat = new Stat(); c.Stat.Mana = r.GetDouble("Mana"); c.Stat.ManaPerLv = r.GetDouble("ManaPerLevel"); c.Stat.MagicResist = r.GetDouble("MagicResist"); c.Stat.MagicResistPerLv = r.GetDouble("MagicResistPerLevel"); return c; }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString.Count==0) { evtid = "2"; } else { evtid = Request.QueryString["eventid"]; } try { con.Open(); cmddispevt = new MySqlCommand("select name,detail,img1path,img2path,img3path from events where rowid=" + evtid, con); drdispevt = cmddispevt.ExecuteReader(); drdispevt.Read(); EventHead = drdispevt.GetString("name"); EventStory = drdispevt.GetString("detail"); img1.Src = "../"+drdispevt.GetString("img1path") + "thumbs/img1.jpg"; img2.Src = "../" + drdispevt.GetString("img2path") + "thumbs/img2.jpg"; img3.Src = "../" + drdispevt.GetString("img3path") + "thumbs/img3.jpg"; aimg1.HRef = "../" + drdispevt.GetString("img1path") + "slides/img1.jpg"; aimg2.HRef = "../" + drdispevt.GetString("img2path") + "slides/img2.jpg"; aimg3.HRef = "../" + drdispevt.GetString("img3path") + "slides/img3.jpg"; drdispevt.Close(); con.Close(); } catch (Exception ex) { CreateLogFile errlog = new CreateLogFile(); errlog.ErrorLog(Server.MapPath("../Logs/Errorlog"), "Page Load of AboutSSNAA Page for " + Session["loginname"] + ":" + ex.Message); } }
private bool Get_Support_Tickets() { try { //MySQL_ITIS A = new MySQL_ITIS(); if (MySQL_ITIS.openConnection() == false) { throw new Exception("MySQL Connection is not open!"); } if (MySQL_ITIS.cmd != null) { MySQL_ITIS.cmd.Dispose(); } string _Query = null; _Query = Pub.isIT_Support() ? "SELECT * FROM IT_WORKSTATIONS.tickets_new;" : string.Format("SELECT * FROM IT_WORKSTATIONS.tickets_new WHERE tickets_new.requestee LIKE '{0}' and DATE_FILED >= '2021-05-01';", Pub.MyDisplayName()); //_Query = "SELECT * FROM IT_WORKSTATIONS.tickets_new;"; MySQL_ITIS.cmd = new MySqlCommand(_Query); MySQL_ITIS.conn.Open(); MySQL_ITIS.cmd.Connection = MySQL_ITIS.conn; MySql.Data.MySqlClient.MySqlDataReader r = MySQL_ITIS.cmd.ExecuteReader(); Support_Tickets = new List <Support_Ticket>(); while (r.Read()) { Support_Tickets.Add(new Support_Ticket { _TicketID = int.Parse(r.GetString("ticketid")).ToString("000000"), _Date_Filed = DateTime.Parse(r.GetString("Date_Filed")).ToString("MM/dd/yyyy"), _Requestee = r.GetString("Requestee"), _Description = r.IsDBNull(3) ? null : r.GetString("description"), _Status = r.GetString("status"), _Last_Update = r.IsDBNull(5) ? null : DateTime.Parse(r.GetString("Last_Update")).ToString("MM/dd/yyyy"), _Assigned_IT = r.IsDBNull(6) ? null : r.GetString("Assigned_IT"), _IT_Remarks = r.IsDBNull(7) ? null : r.GetString("IT_Remarks"), TAG = Set_TAG(r.GetString("status")) }); } MySQL_ITIS.conn.Close(); MySQL_ITIS.conn.Dispose(); return(true); } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message, "CSF TICKETING", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } }
public void AddIngredientBookmarks() { List <int> ingredientBookmarkList = StringToIntList(Panels.instance.memberInfo.member.ingredientBookmarks); int amount = ingredientBookmarkList.Count; Vector2 panelSize = body.GetComponent <RectTransform>().rect.size; RectTransform content = body.GetChild(1).GetChild(0).GetComponent <RectTransform>(); float ySize = panelSize.y / ingredientOnePageAmount; float contentYSize = panelSize.y; if (amount > ingredientOnePageAmount) { contentYSize = ySize * amount; } content.offsetMin = new Vector2(0, 0); content.offsetMax = new Vector2(0, contentYSize); content.localPosition = new Vector2(0, -contentYSize / 2); for (int i = 0; i < amount; i++) { Transform newBookmark = Instantiate(ingredientBookmark); newBookmark.SetParent(content); IngredientBookmark bookmarkInfo = newBookmark.GetComponent <IngredientBookmark>(); ingredientBookmarks.Add(bookmarkInfo); RectTransform rectTransform = newBookmark.GetComponent <RectTransform>(); rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = new Vector2(0, ySize); rectTransform.localPosition = new Vector2(0, contentYSize / 2 + -ySize * i - ySize / 2); int ingredientID = ingredientBookmarkList[i]; string sql = "SELECT * FROM ingredient WHERE id = " + ingredientID + ";"; MySql.Data.MySqlClient.MySqlDataReader reader = DbConnecter.instance.Reader(sql); reader.Read(); Ingredient ingredient = new Ingredient(); ingredient.id = reader.GetInt32(0); ingredient.casNo = reader.GetString(1); ingredient.english = reader.GetString(2); ingredient.korean = reader.GetString(3); ingredient.ewgGrade = reader.GetString(4); ingredient.eye = reader.GetString(5); ingredient.respiratory = reader.GetString(6); ingredient.digestive = reader.GetString(7); ingredient.reproductive = reader.GetString(8); ingredient.integumentary = reader.GetString(9); reader.Close(); DbConnecter.instance.CloseConnection(); IngredientInfo ingredientInfo = newBookmark.GetChild(0).GetComponent <IngredientInfo>(); ingredientInfo.IngredientChange(ingredient, gameObject); bookmarkInfo.ingredientID = ingredient.id; } }
public Session createSessionFromDataReader(MySqlDataReader dr) { Session session; String userLogin; int code = 0; DateTime date; String dateString; Video video; String mode; String comment; float evaluetion; if (dr.Equals(DBNull.Value)) return null; if (!dr["comment"].Equals(DBNull.Value)) comment = dr.GetString("comment"); else comment = ""; if (dr["code"].Equals(DBNull.Value)) return null; code = dr.GetInt32("code"); if (dr["userLogin"].Equals(DBNull.Value)) return null; userLogin = dr.GetString("userLogin"); if (!dr["evaluetion"].Equals(DBNull.Value)) evaluetion = (float)Convert.ToDouble(dr.GetDecimal("evaluetion")); else evaluetion = 0; DaoVideo daoVideo = new DaoVideo(); daoVideo.openConnection(); video = daoVideo.getVideoByCode(dr.GetInt32("videoCode")); date = dr.GetDateTime("date"); dateString = date.Day + "/" + date.Month + "/" + date.Year; if (!dr["modeCode"].Equals(DBNull.Value)) mode = getModeByCode(dr.GetInt32("modeCode")); else mode = ""; session = new Session(userLogin, video, dateString, evaluetion, mode, comment); session.setCode(code); return session; }
public UUID GenerateUUID(string Table) { string ID = ""; bool done = false; connection = new MySqlConnection(MyConString); command = connection.CreateCommand(); while (!done) { ID = GenUUID(); command.CommandText = "SELECT * FROM " + Table + " WHERE " + (Table == "BearFood" ? "StorageID" : "BearID") + " = '" + ID + "'"; connection.Open(); Reader = command.ExecuteReader(); if(Reader.Read() == true) { Reader.GetString("BearsID"); done = false; } else { done = true; } connection.Close(); } UUIDs = ID; return this; }
private void DoSQLAffiche1() { try { String connString = System.Configuration.ConfigurationManager.ConnectionStrings["WebAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); queryStr = ""; queryStr = "SELECT * FROM database.event WHERE event.iduser='******' AND event.idex='2'"; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, conn); reader = cmd.ExecuteReader(); while (reader.HasRows && reader.Read()) { namec1 = reader.GetString(reader.GetOrdinal("name")); monthstart1 = reader.GetInt32(reader.GetOrdinal("monthstart")); yearstart1 = reader.GetInt32(reader.GetOrdinal("yearstart")); daystart1 = reader.GetInt32(reader.GetOrdinal("daystart")); yearend1 = reader.GetInt32(reader.GetOrdinal("yearend")); monthend1 = reader.GetInt32(reader.GetOrdinal("monthend")); dayend1 = reader.GetInt32(reader.GetOrdinal("dayend")); hstart1 = reader.GetInt32(reader.GetOrdinal("hstart")); hend1 = reader.GetInt32(reader.GetOrdinal("hend")); minstart1 = reader.GetInt32(reader.GetOrdinal("minstart")); minend1 = reader.GetInt32(reader.GetOrdinal("minend")); } Labelnamec1.Text = namec1; } catch (Exception ex) { Console.WriteLine(ex); } reader.Close(); conn.Close(); }
public static String SafeGetString(MySqlDataReader reader, string colName) { if (!reader.IsDBNull(reader.GetOrdinal(colName))) return reader.GetString(colName); else return string.Empty; }
public static RobaDTO readerToRobaDTO(MySqlDataReader reader) { RobaDTO roba = new RobaDTO(); roba.SifraRoba = reader.GetInt32("SifraRoba"); roba.Naziv = reader.GetString("Naziv"); return roba; }
protected Game GetGameFromDataReader(MySqlDataReader dataReader) { string gameNaam = dataReader.GetString("gamenaam"); int gameId = dataReader.GetInt32("game_id"); Game game = new Game { ID = gameId, Naam = gameNaam }; return game; }
public void findAll() { db = new Database(); brands.Clear(); brandQuery = new MySqlCommand(); brandQuery.Connection = db.Connection(); brandQuery.CommandText = "SELECT * FROM brand ORDER BY brandname ASC"; this.brandResult = brandQuery.ExecuteReader(); while (brandResult.Read()) { if (!brandResult.IsDBNull(0)) { idbrand = brandResult.GetInt32(0); } if (!brandResult.IsDBNull(1)) { brandname = brandResult.GetString(1); } brands.Add(new Brand { idbrand = this.idbrand, brandname = this.brandname}); } db.Close(); }
private void RetreiveProduct() { ///Get product list from database try { CheckStateDB(); String sqlGet = "SELECT product_id FROM product"; cmd = new MySqlCommand(sqlGet, conn); reader = cmd.ExecuteReader(); if (reader.HasRows == false) { throw new Exception("No row were found!"); } else { while (reader.Read()) { this.prodList.Items.Add(reader.GetString("product_id")); } } reader.Close(); } catch (Exception ex) { ErrorLogCreate(ex); LockWindow(true); } }