please select all column like "SELECT * from Membros WHERE User =
'@User' And Password='@Password'",conn);
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
private void logbtn_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection (@"Data
Source=theserver.com\sqlexpress;Persist Security Info=True;User
ID=UIS;Password=xxxxxx");
SqlCommand comm = new SqlCommand ("SELECT * from Membros
WHERE User = '@User' And Password='@Password'",conn);
comm.Parameters.Add("@@User'",SqlDbType.Text).Value = uidtxt.Text;
comm.Parameters.Add(''@Password'",
SqlDbType.Text).Value = psstxt.Text;
conn.Open();
MessageBox.Show("Conection Open");
int i = (int) comm.ExecuteScalar(); --> Here lives the error !
if (i<0)
MessageBox.Show("Conection Open test 2");
else
MessageBox.Show("Usuário ou Senha Incorreto,
tembém verifique sua conexão com a internet");
conn.Close();
On 8/18/09, Paulo Hendler <[email protected]> wrote:
> Hello Guys...
>
>
> I'm trying to do a Login Area form after splash form (C# windows forms
> aplication), and a table named Membros
> where are the colummns User, Password in a web SQL Server to run the client
> access.
> But I've an error near keyword "From". Follow the code:
>
>
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Data.SqlTypes;
> using System.Data.SqlClient;
> using System.Drawing;
> using System.Text;
> using System.Windows.Forms;
> using System.Threading;
>
>
>
> private void logbtn_Click(object sender, EventArgs e)
> {
>
> SqlConnection conn = new SqlConnection (@"Data Source=
> theserver.com\sqlexpress;Persist Security Info=True;User
> ID=UIS;Password=xxxxxx");
> SqlCommand comm = new SqlCommand ("SELECT from Membros WHERE User
> = '@User' And Password='@Password'",conn <Password='@Password'%22,conn>);
>
> comm.Parameters.Add("@*...@user'*",SqlDbType.Text).Value =
> uidtxt.Text;
> comm.Parameters.Add(''*...@password' <''@Password'>*",
> SqlDbType.Text).Value = psstxt.Text;
> conn.Open();
> MessageBox.Show("Conection Open");
>
>
> *int i = (int) comm.ExecuteScalar(); --> Here lives the error !*
>
>
> if (i<0)
> MessageBox.Show("Conection Open test 2");
> else
> MessageBox.Show("Usuário ou Senha Incorreto, tembém
> verifique sua conexão com a internet");
> conn.Close();
>
>
>
>
> And the Error:
> sqlexception was unhandled
>
> *Incorrect syntax near the keyword 'from'.*
> **
> **
> *I don't know what's bad done, and if anyone know other way to do it I'm
> ready to try, or to set this code right!*
> *HUAhuh*
> **
> **
> *Thank's for now*
>