Hvad pokker gør jeg, jeg har lavet flg:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using MySql.Data;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
static string getMd5Hash(string input)
{
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
int val1 = textBox1.MaxLength;
int val2 = textBox2.MaxLength;
string input = textBox2.Text;
if (val1 != 0 && val2 != 0 && input != "")
{
input = getMd5Hash(input);
LoadGuests(val1, val2, input);
}
}
public void LoadGuests(int valen1, int valen2, string input)
{
try
{
//create a new mysqlconnection
MySqlConnection mycon = new MySqlConnection("datasource=Ipadresse;username=usernamet;password=Passwordet;database=Databasen");
//create a mysql DataAdapter
MySqlDataAdapter myadp = new MySqlDataAdapter("SELECT * FROM users WHERE Nick=" + textBox1.Text + " AND Pass=" + input + "", mycon);
//create a dataset
DataSet myds = new DataSet();
//now fill and bind the DataGrid
myadp.Fill(myds, "users");
dataGrid1.DataSource = myds.Tables["users"].DefaultView;
dataGrid1.SetDataBinding(myds, "users");
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
OG fejlen er flg:
Error 1 The type or namespace name 'MySqlConnection' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\mig\My Documents\Visual Studio 2008\Projects\SQL Login123\SQL Login123\Form1.cs 52 21 SQL Login123
Error 2 The type or namespace name 'MySqlConnection' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\mig\My Documents\Visual Studio 2008\Projects\SQL Login123\SQL Login123\Form1.cs 52 49 SQL Login123
Error 3 The type or namespace name 'MySqlDataAdapter' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\mig\My Documents\Visual Studio 2008\Projects\SQL Login123\SQL Login123\Form1.cs 54 21 SQL Login123
Error 4 The type or namespace name 'MySqlDataAdapter' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\mig\My Documents\Visual Studio 2008\Projects\SQL Login123\SQL Login123\Form1.cs 54 50 SQL Login123
Error 5 'System.Windows.Forms.DataGridView' does not contain a definition for 'SetDataBinding' and no extension method 'SetDataBinding' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\mig\My Documents\Visual Studio 2008\Projects\SQL Login123\SQL Login123\Form1.cs 60 31 SQL Login123
Error 6 The type or namespace name 'MySqlException' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\mig\My Documents\Visual Studio 2008\Projects\SQL Login123\SQL Login123\Form1.cs 62 24 SQL Login123
Hvad skal jeg gøre?