Come On SQLdatareader....read....read....read...ok Help.

Mar 12, 2004

OK, I'm using VS2003 and I'm having trouble. The page works perfectly when I created it with WebMatrix but I want to learn more about creating code behind pages and this page doesn't work. I think it has some things to do with Query builder but I can't seem to get change outside "please register". I have the table populated and it is not coming back with "login successful" or "password wrong" when I've entered correct information. Enclosed is what I've done in VS2003. Can you see where my error is? Any help would be greatly appreciated.


Thanks again.





Imports System.data.sqlclient


Imports System.Data


Public Class login2


Inherits System.Web.UI.Page





#Region " Web Form Designer Generated Code "





'This call is required by the Web Form Designer.


<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()


Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection


Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand


'


'SqlConnection1


'


Me.SqlConnection1.ConnectionString = "server=LAWORKSTATION;user id=sa;database=test;password=t3st"


'


'SqlCommand1


'


Me.SqlCommand1.CommandText = "SELECT pass FROM Customer WHERE (email = 'txtusername.text')"


Me.SqlCommand1.Connection = Me.SqlConnection1





End Sub


Protected WithEvents lblUsername As System.Web.UI.WebControls.Label


Protected WithEvents lblPassword As System.Web.UI.WebControls.Label


Protected WithEvents txtUsername As System.Web.UI.WebControls.TextBox


Protected WithEvents txtPassword As System.Web.UI.WebControls.TextBox


Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button


Protected WithEvents lblMessage As System.Web.UI.WebControls.Label


Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection


Protected WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand





'NOTE: The following placeholder declaration is required by the Web Form Designer.


'Do not delete or move it.


Private designerPlaceholderDeclaration As System.Object





Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init


'CODEGEN: This method call is required by the Web Form Designer


'Do not modify it using the code editor.


InitializeComponent()


End Sub





#End Region





Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


'Put user code to initialize the page here


End Sub





Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click


SqlConnection1.Open()


Dim dr As SqlDataReader = SqlCommand1.ExecuteReader


If dr.Read() Then


If dr("password").ToString = txtPassword.Text Then


lblMessage.Text = "login successful"


Else


lblMessage.Text = "Wrong password"


End If


Else


lblMessage.Text = "Please register"


End If


dr.Close()


SqlConnection1.Close()


End Sub


End Class

View 8 Replies


ADVERTISEMENT

Transact SQL :: Making Server Database Read / Write From Read Only

Jan 12, 2012

i attached adventure works in sql server 2008 and it showing as read only ,make it read write or remove read only tag from database.

View 11 Replies View Related

SQL 2012 :: Identify Whether Files Are In Read / Write Or Read Only

Mar 24, 2015

How to identify whether the files are in read write or read only?

View 1 Replies View Related

Recovery :: Switch (Standby / Read-Only) DB To Be Read And Write

Aug 26, 2015

I'm trying to do Sharepoint DR with Log Shipping and every thing configured except one thing which is switch the WSS_Content (Standby /Read-Only) DB to be ready and Write. 

I tried from

GUI or ALTER DATABASE [WSS_Content] SET
READ_WRITE WITH NO_WAIT

but I received the below error: 

Database WSS_Content is in Warm Standby 

View 9 Replies View Related

Reset Database Files From Read-only To Read-write

Jan 18, 2008

I have two database files, one .mdf and one .ndf. The creator of these files has marked them readonly. I want to "attach" these files to a new database, but cannot do so because they are read-only. I get this message:

Server: Msg 3415, Level 16, State 2, Line 1
Database 'TestSprintLD2' is read-only or has read-only files and must be made writable before it can be upgraded.

What command(s) are needed to make these files read_write?

thanks

View 7 Replies View Related

Read Text File From SQL Server, Read Its Content, And Load It In RichTextBox (Related Component: Context.Response.BinaryWrite(), And StreamReader)

Nov 26, 2007

OBJECTIVE: I would like to read a text file from SQL Server 2000, read the text file content, and load its conntents in a RichTextBoxTHINGS I'VE DONE AND HAVE WORKING:1) I've successfully load a text file (ex: textFile.txt) in sql server database table column (with datatype Image) 2) I've also able to load the file using a Handler as below: using System;using System.Web;using System.Data.SqlClient;public class HandlerImage : IHttpHandler {string connectionString;public void ProcessRequest (HttpContext context) {connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["NWS_ScheduleSQL2000"].ConnectionString;int ImageID = Convert.ToInt32(context.Request.QueryString["id"]);SqlConnection myConnection = new SqlConnection(connectionString);string Command = "SELECT [Image], Image_Type FROM Images WHERE Image_Id=@Image_Id";SqlCommand cmd = new SqlCommand(Command, myConnection);cmd.Parameters.Add("@Image_Id", System.Data.SqlDbType.Int).Value = ImageID;SqlDataReader dr;myConnection.Open(); cmd.Prepare(); dr = cmd.ExecuteReader();if (dr.Read()){ //WRITE IMAGE TO THE BROWSERcontext.Response.ContentType = dr["Image_Type"].ToString();context.Response.BinaryWrite((byte[])dr["Image"]);}myConnection.Close();}public bool IsReusable {get {return false;}}}'>'>
<a href='<%# "HandlerDocument.ashx?id=" + Eval("Doc_ID") %>'>File
</a>- Click on this link, I'll be able to download or view the file WHAT I WANT TO DO, BUT HAVE PROBLEM:- I would like to be able to read CONTENT of this file and load it in a string as belowStreamReader SR = new StreamReader()SR = File.Open("File.txt");String contentText = SR.Readline();txtBox.text = contentText;BUT THIS ONLY WORK FOR files in the server.I would like to be able to read FILE CONTENTS from SQL Server.PLEASE HELP. I really appreciate it.

View 1 Replies View Related

SQL 2012 :: Read Committed For Read Only Database?

Jun 27, 2014

i have a database which get refreshed every day from client's data . and we need to pull heavy data from them every day as reports . so only selects happens on that database.

we do daily population of some table in some other databases from this daily refreshed DB.

will read uncommitted or NOLOCK with select queries to retrieve data faster.

there will be no dirty read as there are NO DML operation in that database so for SELECT which happens concurrently on these tables , will NOLOCK work?

View 2 Replies View Related

SQL 2012 :: Change Read-only And Read-write

Aug 15, 2014

Can a user of db owner role of a database change the databse option to read only and read-write?If not what permission I need to grant to the user?

View 1 Replies View Related

Set READ UNCOMMITTED (dirty Read) At Login.

Jul 23, 2005

Is it possible to set READ UNCOMMITTED to a user connecting to an SQL2000 server instance? I understand this can be done via a front endapplication. But what I am looking to do is to assign this to aspecific user when they login to the server via any entry application.Can this be set with a trigger?

View 1 Replies View Related

Invalid Attempt To Read When No Data Is Present Using SQLdatareader

Jul 2, 2004

I'm trying to determine if the record is NULL/empty or is valid from the datareader.

objReader = strCMD.ExecuteReader
objReader.Read()
if objReader.IsDBNull(0) = true then...

If NULL/Empty, display no records found. If records are found, display "1 or more records have been found". I keep getting the error "Invalid attempt to read when no data is present". I'm not sure what I am doing wrong here.

View 4 Replies View Related

Odd Error Upon SqlDataReader.Read() Invalid Length Parameter Passed To The Substring Function.

Nov 12, 2003

An application I developed normally works great, but it seems that when processing a certian record (and none of the others so far), SQL Server throws this error:
"Invalid length parameter passed to the substring function."

Here's the code in question:

orderConnection.Open()
orderReader = orderCommand.ExecuteReader()
setControls(orderReader)

...

Private Sub setControls(ByVal dr As SqlDataReader)
If (dr.Read()) Then '<--*******problem line*******

The SqlDataReader (orderReader) doesn't blow up or anything until I call .Read() (and, as mentioned, this problem only occurs for one order). What could be happening here?

View 3 Replies View Related

Please Read This, I Need Help!

Aug 15, 2006

Hi!
Can You tell me how can i fix this error:
Cannot open database "DiaulusSimple" requested by the login. The login failed.Login failed for user 'DIAULUSASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Cannot open database "DiaulusSimple" requested by the login. The login failed.Login failed for user 'DIAULUSASPNET'.Source Error:



An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 
I am using ASP.NET, SQLServer2005, Visual Studio  2005

View 5 Replies View Related

How To Read The SQL LOG (.ldf)

Jan 18, 2006

can somebody please tell me a way to read the SQL LOG (.ldf) file i.e
the transactions made to the database from different users

View 1 Replies View Related

How To Read .dll

Feb 15, 2001

Hi guys

How to read .dll files. In which language it will be written.
Can any one of give some details about .dll appreciated.
Thank you.

Paul

View 1 Replies View Related

Read Only?

Aug 4, 1999

looking for SQL Guru who can tell me what I'm doing wrong with the following VB executable which runs on the server, I'm getting the error,
"cannot delete record database is read only."
Seems straight forward but I can delete records from this table remotely via an active server page (asp) no problem.


Thank in Advance

Regards


Bob Cheeseman
King Kommunications <http://www.kingkom.com>
bob@kingkom.com <mailto:bob@kingkom.com>


Public Sub Main()

On Error GoTo skip

Dim stDocName As String
Dim stQuoteName As String
Dim objAccess As Object
Dim myDoCmd As Object
Dim dbs As Database
Dim PrimaryRS As Recordset
Dim location As String

Set dbs = OpenDatabase("NVO", dbDriverNoPrompt, False, "ODBC;DATABASE=NVO2000;DSN=NVO")

Set PrimaryRS = dbs.OpenRecordset("SELECT * FROM quotation_files_temp", dbOpenDynaset)
stQuoteName = PrimaryRS!QuoteNum

Set objAccess = GetObject("C:NVO2000fpdbNVO_FRONTEND.mdb")
objAccess.Application.Visible = False
Set myDoCmd = objAccess.DoCmd
stDocName = "quote"
stQuoteName = stQuoteName & "Q.SNP"
myDoCmd.OutputTo acReport, stDocName, acFormatSNP, "c:vo2000Documents" & stQuoteName

' dbs.Execute ("delete from quotation_files_temp") ' help needed here!!!!

dbs.Close
PrimaryRS.Close
Set dbs = Nothing
Set PrimaryRS = Nothing
objAccess.Application.Quit
Set objAccess = Nothing

Exit Sub
skip:

End Sub

View 1 Replies View Related

How To Read DTS Log ?

Apr 5, 2004

Hi everybody,
Someone to know a program for DTS log reading ?
When I open it with Wordpad there was same confusion.
Thanks a lot.

View 1 Replies View Related

Read Only Databases

Mar 26, 2007

ok when i upload my databases that i created in VS2005, they are read only.
 so i though something was just funny, so i installed sql managment studio on the server and attached the databases, and when i attached them there grey with (READ-ONLY) displayed... how can i get my DB's out of read only! i tryied going through the properties of the DB through MSSQL managenet studio but that only generates an error...
 any ideas!

View 3 Replies View Related

Read Timeout

Apr 21, 2007

Hi Friends,
I have the text file in my server which is 21 MB size.
i want to insert that text file into temporary table and then based on the conditions will insert the original table.But before inserting all the records in temporary table, i got the below error message but the backend process still running(inserting into temp table)
The following error was encountered:

Read Timeout
The system returned: [No Error]
A Timeout occurred while waiting to read data from the network. The network or server may be down or congested. Please retry your request.
I am using the following code configuration section
<sessionState timeout="600" />
<httpRuntime
executionTimeout="110"
maxRequestLength="21504"
requestLengthDiskThreshold="80"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="5000"
enableKernelOutputCache="true"
enableVersionHeader="true"
requireRootedSaveAsPath="true"
enable="true"
shutdownTimeout="90"
delayNotificationTimeout="5"
waitChangeNotification="0"
maxWaitChangeNotification="0"
enableHeaderChecking="true"
sendCacheControlHeader="true"
apartmentThreading="false" />
 
How to implement the page keep active while all the records are inserted into DB?
 

View 1 Replies View Related

How Can I Use SqlDataSource To Read A Row?

May 19, 2007

The new databound controls are great, but somehow doing the simpler things has gotten harder.The code is in a function that is passed pollid.  I want to use SqlDataSource to get the smallest value of answerid where pollid = the value passed for pollid.  For example:"Select top from PollAsnwers where pollid=" & PollId & " order by AnswerId" I can set up the SqlDataSource for a data reader to fill a GridView control, but that isn't what I want to do.  In fact, I can't find anything on SqlDataSource that doesn't also involve the GridView control.I have so far:Dim myConnection As SqlConnectionDim myCommand As SqlCommandDim myReader As SqlDataReadermyConnection = New SqlConnection()myConnection.ConnectionString = ConfigurationManager.ConnectionStrings("UserPolls").ConnectionStringmyCommand = New SqlCommand()myCommand.CommandText = "Select top from PollAsnwers where pollid=" & PollId & " order by AnswerId"myCommand.CommandType = CommandType.TextmyCommand.Connection = myConnectionmyCommand.Connection.Open() Now assuming I have a single row of data, how do I read the value of Answerid?   If I have this wrong, what should I have?  Diane 

View 6 Replies View Related

Database Is Read-only

Oct 2, 2007

getting this error after publishing my site to local IIS, then trying my signup page.
Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only.
have tryed to change the attributes, still not working. have given write access to the APP_DATA folder from IIS, still not working.
and i cannot delete the APP_DATA folder from IIS, it says it is being used by another process or program. how to fix this? and or delete the folder?
 

View 1 Replies View Related

Read The Table

Feb 12, 2008

Hey ,
            I have sql server 2000, and i am using Microsoft Application block.  
 I have Transaction Like... 
 SqlConnection conn = new SqlConnection(ASLConnectionString);                    conn.Open();                    SqlTransaction Trans = conn.BeginTransaction(IsolationLevel.ReadUncommitted); 
But If i have another process that try to read the Table if that old transaction running.. it wouldn't Allow me to read the DATA.
 i tried Isolation level "snapshot" but that works under sql server 2005 only. so i can not use that. And i have some services that will run during day time.
 So if anybody have solution to read the data from table...from sql server 2000 even if another transaction is running?
Please Give any guideline..Help will be appriciated.
 
thanks & regards,
Nirav Patel
 

View 1 Replies View Related

Plz Read It Very Urgent

Apr 30, 2008

I am work with Asp.net 2.0 C#In my application i want to use following stored procedure.I am having two dropdownlist first one is show emplyees who is having MgrID is nullif i select anyone from first dropdown list the second dropdown is show the employees name who is working below the selected personhow to i get the values from folowing stored produre.i have created the following samples table.this Stored procedure is giving my values when i am excute in Query analyserBut i dont know how to cal this Stredprocedure in my code behind and how to excute when i am select dropdown oneCREATE TABLE dbo.Emp(EmpID int PRIMARY KEY,EmpName varchar(30),MgrID int FOREIGN KEY REFERENCES Emp(EmpID))GOCREATE NONCLUSTERED INDEX NC_NU_Emp_MgrID ON dbo.Emp(MgrID)INSERT dbo.Emp SELECT 1, 'President', NULLINSERT dbo.Emp SELECT 2, 'Vice President', 1INSERT dbo.Emp SELECT 3, 'CEO', 2INSERT dbo.Emp SELECT 4, 'CTO', 2INSERT dbo.Emp SELECT 5, 'Group Project Manager', 4INSERT dbo.Emp SELECT 6, 'Project Manager 1', 5INSERT dbo.Emp SELECT 7, 'Project Manager 2', 5INSERT dbo.Emp SELECT 8, 'Team Leader 1', 6INSERT dbo.Emp SELECT 9, 'Software Engineer 1', 8INSERT dbo.Emp SELECT 10, 'Software Engineer 2', 8INSERT dbo.Emp SELECT 11, 'Test Lead 1', 6INSERT dbo.Emp SELECT 12, 'Tester 1', 11INSERT dbo.Emp SELECT 13, 'Tester 2', 11INSERT dbo.Emp SELECT 14, 'Team Leader 2', 7INSERT dbo.Emp SELECT 15, 'Software Engineer 3', 14INSERT dbo.Emp SELECT 16, 'Software Engineer 4', 14INSERT dbo.Emp SELECT 17, 'Test Lead 2', 7INSERT dbo.Emp SELECT 18, 'Tester 3', 17INSERT dbo.Emp SELECT 19, 'Tester 4', 17INSERT dbo.Emp SELECT 20, 'Tester 5', 17CREATE PROC dbo.ShowHierarchy(@Root int)ASBEGINSET NOCOUNT ONDECLARE @EmpID int, @EmpName varchar(30)SET @EmpName = (SELECT EmpName FROM dbo.Emp WHERE EmpID = @Root)PRINT REPLICATE('-', @@NESTLEVEL * 4) + @EmpNameSET @EmpID = (SELECT MIN(EmpID) FROM dbo.Emp WHERE MgrID = @Root)WHILE @EmpID IS NOT NULLBEGINEXEC dbo.ShowHierarchy @EmpIDSET @EmpID = (SELECT MIN(EmpID) FROM dbo.Emp WHERE MgrID = @Root AND EmpID > @EmpID)ENDENDOUTPUTEXEC dbo.ShowHierarchy 1GO---President------Vice President---------CEO---------CTO------------Group Project Manager---------------Project Manager 1------------------Team Leader 1---------------------Software Engineer 1---------------------Software Engineer 2------------------Test Lead 1---------------------Tester 1---------------------Tester 2---------------Project Manager 2------------------Team Leader 2---------------------Software Engineer 3---------------------Software Engineer 4------------------Test Lead 2---------------------Tester 3---------------------Tester 4---------------------Tester 5OUTPUTEXEC dbo.ShowHierarchy 5GO---Group Project Manager------Project Manager 1---------Team Leader 1------------Software Engineer 1------------Software Engineer 2---------Test Lead 1------------Tester 1------------Tester 2------Project Manager 2---------Team Leader 2------------Software Engineer 3------------Software Engineer 4---------Test Lead 2------------Tester 3------------Tester 4------------Tester 5IF YOU HAVE ANY IDEA PLZ SEND TO MERegardsBeginner

View 4 Replies View Related

Is Identity Is Read Only

Jun 2, 2008

Hi everyone,
 I have a table with a primary key called ID.
My problem is that I can NOT set the  Is Identity propertiy of ID to yes!
How can I enable that field? or set it to yes?
 
Thank's a lot
/Pepe

View 3 Replies View Related

The Database Is Read-only.

May 31, 2005

I use MS Sql DataBase file (SQL 2005 )as the conneciton in my project.When I use GridView to update my database, it fail:The error message is :Failed to update database "D:DATAASPNETHEALTH8APP_DATADBHEALTH.MDF" because the database is read-only. What is the problem with it?

View 12 Replies View Related

ASPNETDB.MDF Is Read-only....

Apr 25, 2006

Hello everyone.
I am to create a sample site using the club site example. I had a problem with the IIS but now it is solved.
Now i copyied the site to the IIS and it is running. But i cannot access ASPNETDB.MDF. It keep saying that the database is read only... It is not read only!!!
Can any one help me??
System.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTNEOAPP_DATAASPNETDB.MDF" because the database is read-only.
Thank you in advance.
Iasonas

View 2 Replies View Related

Read Only Database

May 8, 2000

Hello,

I'm optimizing a database running under SQL 7.0. Have anyone any knowledge wether setting the database to "read only" can enhance performance? The database is used only for reading, one table is updated via DTS on a hourly basis, the rest of the tables on a daily basis.

Brgds

Jonas Hilmersson

View 3 Replies View Related

Read File

Aug 28, 2003

Any one can help me how to read a file(.txt) with in the store procedure?

View 2 Replies View Related

SQL 6.5/VB 6 &#34;Read Only&#34; Error

Dec 21, 1998

Hi all!

This is my first time to use SQL Server with VB, so if I've left out any relevant information, please let me know.

Here's my problem: When I try to execute the RDO AddNew method, I get an error -- "The Resultset is Read Only." When I click on the debug option, the code has stopped at the .addnew line.

When I connect to the SQL database, I use this code:

Set gcnPRP = rdoEnvironments(0).OpenConnection( _
dsName:="PropertyControl", _
Prompt:=rdDriverNoPrompt, _
Connect:="uid=pgmr;pwd=blue;driver={SQL Server];" & _
"server =nt3,database=testpropcontdb;")

and:

Set grsPRP = gcnPRP.OpenResultset(gstrSQL, rdOpenDynamic, rdConcurRowVer, rdExecDirect)

I would really appreciate a gentle nudge in the right direction, even if it's only a recommendation for further reading I could do.

Thanks so much!

Elizabeth Fisher

View 1 Replies View Related

Dirty Read

Jun 10, 1999

Can someone tell me what a dirty read is?

View 1 Replies View Related

Why Is &#34;&#34; Read As A Tab Delimiter In DTS?

May 22, 2001

hello!

i was on with DTS, dumping a flat file to SQL DB and i came across an error which says: "Too many columns...; found whitespaces.."

When I checked the row that caused this, I found out that entries with ""s are split into two columns possibly because the backslashes were read as tab delimiters..

I've tried other delimiters, but they do not seem to fit because most of the entries have them.

Please advise. Thanks!

View 1 Replies View Related

Read-only Table

Aug 9, 2004

Hello,

I was wondering how to make a table read-only. I want to make a script that creates a table, adds some data to it, then makes the table read-only to prevent someone from accidentally changing the values.

Thanks to anyone who can help,
Chris

View 2 Replies View Related

How To Read Log Files

Oct 12, 2004

Some records got deleted from our DB. We don't have any triggers to log this delete transaction. Is there anyway to find out from log files or someother places to find out about this deletion. Is this information stored in transaction log. We do complete backup every night. So I think the transaction log will be truncated after the complete backup right?
Please advise on this.

thanks

View 1 Replies View Related

How To Read The Column Name?

Oct 21, 2004

Hello, everyone:

How to get the column name from a table? Thanks.

ZYT

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved