Current location: Hot Scripts Forums » Programming Languages » ASP.NET » How Can I Resolve Operating System Error 32


How Can I Resolve Operating System Error 32

Reply
  #1 (permalink)  
Old 12-17-08, 03:33 PM
option.explicit option.explicit is offline
New Member
 
Join Date: Dec 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy How Can I Resolve Operating System Error 32

I'm trying to write my first breakthrough online software for a high school, to enable them store student and school records on an internet website where students and parents can have round the clock access to those records when needed.

I am using ASP.NET in Microsoft Visual Studio.NET 2008, and my language of choice is Visual Basic... My Data provider is MS SQL Server 2008.

Problem is that I hit my first snag when, I tried to access information from the database...

Initially, I am able to access the website through a login system that compares a user's login details with the records in a table, no problem, validation and authentication sails through smoothly... Calling the Reader.close () method at every step to close the connection appropriately...

Here is the code...
Code:
' Build the SQL and Connection strings.
Dim sql As String = "SELECT * FROM LoginUserData WHERE LoginUserName ='" & MyOwnString + "' "
 
Dim connectionString As String = "Initial Catalog=SchoolPortalData;" & "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\WebSite3\App_Data\SchoolPortalData.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
 
' Initialize the SqlCommand with the SQL query and connection strings.
Using MyWebConnection As New System.Data.SqlClient.SqlConnection(connectionString)
 
Using command As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(sql, MyWebConnection)
' Open the connection.
 
command.Connection.Open()
 
'` Execute the query, return a SqlDataReader object.
'` CommandBehavior.CloseConnection flags the
'` DataReader to automatically close the DB connection
'` when it is closed.
 
Dim reader As System.Data.SqlClient.SqlDataReader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
 
Do While reader.Read
 
MyOwnStr = reader.GetString(3).ToString
MyOwnLoginType = Val(reader.GetString(6)) ' & " " & reader.GetString(2))
MyOwnLoginID = reader.GetString(0)
 
Loop
 
If reader.HasRows = True Then Label1.Text = Validation1Success Else Label1.Text = Validation2ErrorMessage
 
'` Close the DataReader (and its connection).
 
reader.Close()
 
command.Connection.Close()
command.Connection.Dispose()
command.Connection = Nothing
command.Dispose()
Yet when I try to reaccess the same table with the SQLDataReader Control from another page within the website, the program crashes and I end up with Operating System Error 32, and with no clue in the world on how to resolve it...

I was wondering if you could PLEASE help me out, I DO appreciate every assistance you offer me. Thank you.

Best Regards...

Last edited by digioz; 12-17-08 at 07:25 PM. Reason: Please use CODE Tags!
Reply With Quote
  #2 (permalink)  
Old 12-17-08, 03:57 PM
s1yfa's Avatar
s1yfa s1yfa is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Sheerness, Kent UK
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
This error occurs when the file is still being accessed by another process (or page). You may not have fully closed the connection properly on the previous page when you navigated away to another page. Or permissions are not set for all your pages.

Have a look at this Microsoft forum entry for more info, it might help.
http://social.msdn.microsoft.com/for...-2e2b3fb73c2a/
__________________
Users /nm./: collective term for those who use computers.
Novice Users: people who are afraid that simply pressing a key might break their computer.
Intermediate Users: people who don't know how to fix their computer after they've just pressed a key that broke it.
Expert Users: people who break other people's computers.
Reply With Quote
  #3 (permalink)  
Old 12-18-08, 02:23 PM
option.explicit option.explicit is offline
New Member
 
Join Date: Dec 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Tanx s1yfa,

I've been able to locate the fault... it was hidden in my connection string:

I assembled the connection string like this:

Dim connectionString As String = "Initial Catalog=SchoolPortalData;" & "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\WebSite3\A pp_Data\SchoolPortalData.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

The connection string should instead be written like this:

Dim connectionString As String = "Initial Catalog=SchoolPortalData;" & "Data Source=.\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;User Instance=True"

hence solved....
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with a store system spyke01 JavaScript 16 08-22-06 04:56 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 06:02 AM
Link system TAK PHP 3 08-17-03 11:17 AM
Good template system [PL]Greg PHP 3 06-28-03 04:09 AM


All times are GMT -5. The time now is 02:41 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.