[size=2][color=#0000ff]Imports[/color][/size][size=2] System.Data.SqlClient
[/size][size=2][color=#0000ff]Imports[/color][/size][size=2] System.Data
[/size][size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Class[/color][/size][size=2] Form1
[/size][size=2][color=#0000ff]Private[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] conn [/size][size=2][color=#0000ff]As[/color][/size][size=2] SqlConnection = [/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlConnection([/size][size=2][color=#800000]"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Jon\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Database1.mdf;Integrated Security=True;User Instance=True"[/color][/size][size=2])
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] ds [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataSet
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] adapter [/size][size=2][color=#0000ff]As[/color][/size][size=2] SqlDataAdapter
[/size][size=2][color=#0000ff]Try
[/color][/size][size=2]adapter = [/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlDataAdapter([/size][size=2][color=#800000]"sp_getusers "[/color][/size][size=2], conn)
adapter.SelectCommand.CommandType = CommandType.StoredProcedure
adapter.SelectCommand.Parameters.Add([/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlParameter([/size][size=2][color=#800000]"@Username"[/color][/size][size=2], SqlDbType.Text))
adapter.SelectCommand.Parameters.Add([/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlParameter([/size][size=2][color=#800000]"@Password"[/color][/size][size=2], SqlDbType.Text))
adapter.SelectCommand.Parameters.Add([/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlParameter([/size][size=2][color=#800000]"@Rowcount"[/color][/size][size=2], SqlDbType.Int, 4))
adapter.SelectCommand.Parameters([/size][size=2][color=#800000]"@Username"[/color][/size][size=2]).Value = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].TextBox1.Text
adapter.SelectCommand.Parameters([/size][size=2][color=#800000]"@Password"[/color][/size][size=2]).Value = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].TextBox2.Text
adapter.SelectCommand.Parameters([/size][size=2][color=#800000]"@Rowcount"[/color][/size][size=2]).Direction = ParameterDirection.Output
ds = [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataSet
adapter.Fill(ds, [/size][size=2][color=#800000]"Users"[/color][/size][size=2])
[/size][size=2][color=#0000ff]If[/color][/size][size=2] adapter.SelectCommand.Parameters(2).Value = 0 [/size][size=2][color=#0000ff]Then
[/color][/size][size=2][/size][size=2][color=#0000ff]Me[/color][/size][size=2].Label1.Text = [/size][size=2][color=#800000]"The user doesn't exist"
[/color][/size][size=2][/size][size=2][color=#0000ff]Else
[/color][/size][size=2][/size][size=2][color=#0000ff]Me[/color][/size][size=2].Label1.Text = [/size][size=2][color=#800000]"The user '"[/color][/size][size=2] & [/size][size=2][color=#0000ff]Me[/color][/size][size=2].TextBox1.Text & [/size][size=2][color=#800000]"' exists"
[/color][/size][size=2][/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]If
[/color][/size][size=2][/size][size=2][color=#0000ff]Catch[/color][/size][size=2] ex [/size][size=2][color=#0000ff]As[/color][/size][size=2] Exception
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].Label1.Text = ex.ToString
[/size][size=2][color=#0000ff]Finally
[/color][/size][size=2]adapter.Dispose()
conn.Close()
[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Try
[/color][/size][size=2][/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub
End[/color][/size][size=2] [/size][size=2][color=#0000ff]Class
[/color][/size]