Correct the select statement. "Select user from Membros"  ... or
"Select ***from  Membros"

 SqlCommand comm = new SqlCommand ("SELECT  from Membros WHERE User =
'@User' And Password='@Password'",conn <Password='@Password'%22,conn>);






On Tue, Aug 18, 2009 at 8:21 AM, 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*
>
>
>
>

Reply via email to