changet location SQL code from = to like % %

This commit is contained in:
Ismail 2017-07-27 15:52:00 +02:00
parent 59863aa937
commit bdd791b053
2 changed files with 30 additions and 6 deletions

View File

@ -20,7 +20,7 @@ namespace db_AI_4
using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("marketdb"))) using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("marketdb")))
{ {
var output = connection.Query<GetLocations>($"SELECT * FROM locations WHERE location_name = '{ LocationName }'").ToList(); var output = connection.Query<GetLocations>($"SELECT * FROM locations WHERE location_name like '%{ LocationName }%'").ToList();
return output; return output;
} }
@ -104,7 +104,7 @@ namespace db_AI_4
} }
else else
{ {
MessageBox.Show("username or passord not correct"); MessageBox.Show("Username or Password not correct");
} }
//CheckLogin function end //CheckLogin function end

View File

@ -33,11 +33,13 @@
this.PasswordLoginBox = new System.Windows.Forms.TextBox(); this.PasswordLoginBox = new System.Windows.Forms.TextBox();
this.LoginLabel = new System.Windows.Forms.Label(); this.LoginLabel = new System.Windows.Forms.Label();
this.LoginButton = new System.Windows.Forms.Button(); this.LoginButton = new System.Windows.Forms.Button();
this.EmailLabel = new System.Windows.Forms.Label();
this.PasswordLabel = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// RegistrationButton // RegistrationButton
// //
this.RegistrationButton.Location = new System.Drawing.Point(15, 145); this.RegistrationButton.Location = new System.Drawing.Point(86, 145);
this.RegistrationButton.Name = "RegistrationButton"; this.RegistrationButton.Name = "RegistrationButton";
this.RegistrationButton.Size = new System.Drawing.Size(75, 23); this.RegistrationButton.Size = new System.Drawing.Size(75, 23);
this.RegistrationButton.TabIndex = 0; this.RegistrationButton.TabIndex = 0;
@ -47,14 +49,14 @@
// //
// EmailLoginBox // EmailLoginBox
// //
this.EmailLoginBox.Location = new System.Drawing.Point(15, 50); this.EmailLoginBox.Location = new System.Drawing.Point(86, 44);
this.EmailLoginBox.Name = "EmailLoginBox"; this.EmailLoginBox.Name = "EmailLoginBox";
this.EmailLoginBox.Size = new System.Drawing.Size(174, 22); this.EmailLoginBox.Size = new System.Drawing.Size(174, 22);
this.EmailLoginBox.TabIndex = 1; this.EmailLoginBox.TabIndex = 1;
// //
// PasswordLoginBox // PasswordLoginBox
// //
this.PasswordLoginBox.Location = new System.Drawing.Point(15, 94); this.PasswordLoginBox.Location = new System.Drawing.Point(86, 87);
this.PasswordLoginBox.Name = "PasswordLoginBox"; this.PasswordLoginBox.Name = "PasswordLoginBox";
this.PasswordLoginBox.PasswordChar = '*'; this.PasswordLoginBox.PasswordChar = '*';
this.PasswordLoginBox.Size = new System.Drawing.Size(174, 22); this.PasswordLoginBox.Size = new System.Drawing.Size(174, 22);
@ -71,7 +73,7 @@
// //
// LoginButton // LoginButton
// //
this.LoginButton.Location = new System.Drawing.Point(114, 145); this.LoginButton.Location = new System.Drawing.Point(185, 145);
this.LoginButton.Name = "LoginButton"; this.LoginButton.Name = "LoginButton";
this.LoginButton.Size = new System.Drawing.Size(75, 23); this.LoginButton.Size = new System.Drawing.Size(75, 23);
this.LoginButton.TabIndex = 7; this.LoginButton.TabIndex = 7;
@ -79,11 +81,31 @@
this.LoginButton.UseVisualStyleBackColor = true; this.LoginButton.UseVisualStyleBackColor = true;
this.LoginButton.Click += new System.EventHandler(this.LoginButton_Click); this.LoginButton.Click += new System.EventHandler(this.LoginButton_Click);
// //
// EmailLabel
//
this.EmailLabel.AutoSize = true;
this.EmailLabel.Location = new System.Drawing.Point(12, 44);
this.EmailLabel.Name = "EmailLabel";
this.EmailLabel.Size = new System.Drawing.Size(42, 17);
this.EmailLabel.TabIndex = 8;
this.EmailLabel.Text = "Email";
//
// PasswordLabel
//
this.PasswordLabel.AutoSize = true;
this.PasswordLabel.Location = new System.Drawing.Point(12, 87);
this.PasswordLabel.Name = "PasswordLabel";
this.PasswordLabel.Size = new System.Drawing.Size(69, 17);
this.PasswordLabel.TabIndex = 9;
this.PasswordLabel.Text = "Password";
//
// LoginForm // LoginForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(373, 264); this.ClientSize = new System.Drawing.Size(373, 264);
this.Controls.Add(this.PasswordLabel);
this.Controls.Add(this.EmailLabel);
this.Controls.Add(this.LoginButton); this.Controls.Add(this.LoginButton);
this.Controls.Add(this.LoginLabel); this.Controls.Add(this.LoginLabel);
this.Controls.Add(this.PasswordLoginBox); this.Controls.Add(this.PasswordLoginBox);
@ -105,6 +127,8 @@
private System.Windows.Forms.TextBox PasswordLoginBox; private System.Windows.Forms.TextBox PasswordLoginBox;
private System.Windows.Forms.Label LoginLabel; private System.Windows.Forms.Label LoginLabel;
private System.Windows.Forms.Button LoginButton; private System.Windows.Forms.Button LoginButton;
private System.Windows.Forms.Label EmailLabel;
private System.Windows.Forms.Label PasswordLabel;
} }
} }