Click here to Skip to main content
15,914,820 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: TDateTime (Delphi) to VB conversion Pin
Hurricane300027-Oct-07 5:26
Hurricane300027-Oct-07 5:26 
QuestionSystem.Data.SqlClient.SqlDataReader has no instructor??? Pin
kc_renji26-Oct-07 8:07
kc_renji26-Oct-07 8:07 
AnswerRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Dave Kreskowiak26-Oct-07 9:54
mveDave Kreskowiak26-Oct-07 9:54 
GeneralRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Paul Conrad26-Oct-07 17:41
professionalPaul Conrad26-Oct-07 17:41 
GeneralRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Dave Kreskowiak26-Oct-07 18:13
mveDave Kreskowiak26-Oct-07 18:13 
GeneralRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Paul Conrad27-Oct-07 13:06
professionalPaul Conrad27-Oct-07 13:06 
AnswerRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
pmarfleet26-Oct-07 11:48
pmarfleet26-Oct-07 11:48 
AnswerRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Guffa26-Oct-07 23:02
Guffa26-Oct-07 23:02 
What a mess... Wink | ;)

kc_renji wrote:
System.Data.SqlClient.SqlDataReader has no instructor?


Read the error message again. That's not what it says.

Is there a syntax error?


No.

Dim conMbr As New SqlConnection


Don't create a connection object when you declare the reference. As you create another connection object when you open the connection, this first connection object is only created and then thrown away.

Dim cmdMbr As New SqlCommand


Don't create a command object when you declare the reference. As you create another command object when you specify the query, this first command object is only created and then thrown away.

Dim sqlReader As New SqlDataReader


You can't create a data reader using the new keyword, as there is no public constructor that can be used for that.

You shouldn't try to create a data reader object when you declare the reference. As you will be creating one when you execute the query, the first object would only be created and then thrown away.

strVerifyMbr = "SELECT MemberId FROM datMember WHERE memberUserName=@usrId AND memberPassword=@pwd"


If you have parameters in your query, you have to add parameter objects to the command object to provide their values.

While sqlReader.Read()


You have to create the data reader before you can read from it. Call the ExecuteReader method of the command object to execute the query and get the result in a data reader.

If txtLogin.Text=Convert.ToString(sqlReader("memberUsername"))Then


The data reader doesn't contain any field named "memberUsername", as you don't get any data from that field in the query.

If txtPwd.Text=Convert.ToString(sqlReader("memberPassword")) Then


The data reader doesn't contain any field named "memberPassword", as you don't get any data from that field in the query.

Session("password") = sqlReader("memberPassword")


Why are you storing the password in the session variables? Are you going to check the password against the database every time you want to check if the user is logged in?

Else


This will never happen. As you only get the user record from the database if the password is correct, you will never have any record in the data reader where the user name is correct and the password is wrong.

Response.Write("window.alert('Invalid Password. Please try again.');<" + "/script>")</blockquote>

Don't use JScript, that is only supported by Internet Explorer. Use Javascript.

Using Response.Write is not a good way of putting code in the page. It will place the code above the doctype, which will make the browser ignore the doctype and render the page in quirks mode.

<blockquote class="FQ">checkUsr="Failed"</blockquote>

This code will never be reached. If the user name or password is not correct, the data reader will be empty, and you will never enter the loop.

<blockquote class="FQ">If checkUsr ="Failed" Then</blockquote>

As the variable will never have that value, the code in the if statement will never be executed.

<div class="ForumSig"><small><small>---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams</small></small></div>

QuestionMy Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster26-Oct-07 8:05
SlickyMaster26-Oct-07 8:05 
AnswerRe: My Access database isn't being updated, but no errors occurred in my application Pin
Dave Kreskowiak26-Oct-07 9:49
mveDave Kreskowiak26-Oct-07 9:49 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
Paul Conrad27-Oct-07 8:32
professionalPaul Conrad27-Oct-07 8:32 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster29-Oct-07 1:19
SlickyMaster29-Oct-07 1:19 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
Dave Kreskowiak29-Oct-07 2:23
mveDave Kreskowiak29-Oct-07 2:23 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster29-Oct-07 3:58
SlickyMaster29-Oct-07 3:58 
AnswerRe: My Access database isn't being updated, but no errors occurred in my application Pin
Paul Conrad27-Oct-07 8:33
professionalPaul Conrad27-Oct-07 8:33 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster29-Oct-07 4:39
SlickyMaster29-Oct-07 4:39 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
Paul Conrad29-Oct-07 12:57
professionalPaul Conrad29-Oct-07 12:57 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster30-Oct-07 1:26
SlickyMaster30-Oct-07 1:26 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster30-Oct-07 8:19
SlickyMaster30-Oct-07 8:19 
QuestionUsing Multiple Sets of User Settings, How do I retrieve SettingsKey values? Pin
Umbelino26-Oct-07 6:18
Umbelino26-Oct-07 6:18 
AnswerRe: Using Multiple Sets of User Settings, How do I retrieve SettingsKey values? Pin
Dave Kreskowiak26-Oct-07 6:52
mveDave Kreskowiak26-Oct-07 6:52 
GeneralRe: Using Multiple Sets of User Settings, How do I retrieve SettingsKey values? Pin
Umbelino30-Oct-07 8:13
Umbelino30-Oct-07 8:13 
QuestionCan anyone translate this c# code to vb code for me please Pin
kc_renji26-Oct-07 6:01
kc_renji26-Oct-07 6:01 
AnswerRe: Can anyone translate this c# code to vb code for me please Pin
Kschuler26-Oct-07 6:37
Kschuler26-Oct-07 6:37 
AnswerRe: Can anyone translate this c# code to vb code for me please Pin
AliAmjad26-Oct-07 6:38
AliAmjad26-Oct-07 6:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.