I'm having a database insertion problem. I make an entry to my registration form, write it to the database; then the next registration entry displays an error that the same UID can't be written to the database. I don't know where to start tracing this, but here is the stored procedure I use and some of the code that might generate it. @UserName nvarchar(128), @Email nvarchar(50), @FirstName nvarchar(25), @LastName nvarchar(50), @Teacher nvarchar(25), @GradYr int DECLARE @UserID uniqueidentifier SELECT @UserID = NULL SELECT @UserID = UserId FROM dbo.aspnet_Users WHERE LOWER(@UserName) = LoweredUserName INSERT INTO [table name](UserID,UserName,Email,FirstName,LastName,Teacher,GradYr) VALUES (@UserID,@UserName,@Email,@FirstName,@LastName,@Teacher,@GradYr) Protected Sub cuwCreateUserWizard1_CreatingUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles cuwCreateUserWizard1.CreatedUser strEmail = CType(cuwCreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Email"), TextBox).Text strUserName = CType(cuwCreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"), TextBox).Text.ToLower strFirstName = CType(cuwCreateUserWizard1.CreateUserStep.CustomNavigationTemplateContainer.FindControl("txtFirstName"), TextBox).Text strLastName = CType(cuwCreateUserWizard1.CreateUserStep.CustomNavigationTemplateContainer.FindControl("txtLastName"), TextBox).Text lngGradYr = CType(cuwCreateUserWizard1.CreateUserStep.CustomNavigationTemplateContainer.FindControl("txtGradYr"), TextBox).Text strTeacher = CType(cuwCreateUserWizard1.CreateUserStep.CustomNavigationTemplateContainer.FindControl("txtTeacher"), TextBox).Text End Sub Protected Sub cuwCreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles cuwCreateUserWizard1.CreatedUser Dim cmd As New SqlCommand("sp_CreateUser", con) cmd.CommandType = Data.CommandType.StoredProcedure cmd.Parameters.AddWithValue("@UserName", strUserName) cmd.Parameters.AddWithValue("@Email", strEmail) cmd.Parameters.AddWithValue("@FirstName", strFirstName) cmd.Parameters.AddWithValue("@LastName", strLastName) cmd.Parameters.AddWithValue("@Teacher", strTeacher) cmd.Parameters.AddWithValue("@GradYr", lngGradYr) Using con con.Open() cmd.ExecuteScalar() con.Close() End Using cmd.Equals(Nothing) End Sub Please let me know if any other info is needed to help determine what's wrong.
I have a DB with 4 tables in MSSQL6.5. In those tables write an NT service (4 threads for each table) 24h/day. I want to know somehow when i have no write in one of those tables for more than 1-2 hours (i dont want to querry those tables everytimes). MSSQL6.5 offer this kind of facilities? Or I can do this using stored procedures or something else?
I am very new to SQL server and I'm using stored procedures for my program. So far I wrote one tonight, that works just fine. I haven't really written one before, but its kind of similar syntax since I know C++/C# and VB. My question is, even though this works for what I need it do, is it written correctly? Can you see any problems with it, or would you have done it differently? I want to make sure its done correctly, and it runs as fast as possible. Thanks! [pre] CREATE PROCEDURE CreateNewUser @UserID int out, @LoginID nvarchar(30), @Password nvarchar(30), @RegisterDate smalldatetime, @LoginIDExists nvarchar(30)AS /* Check to see if the loginID is already in use before attempting to save it. We MUST have a unique loginID for each user */ SELECT @LoginIDExists = loginID FROM users WHERE loginID = @LoginID /* If we pulled a value from the database, then the loginID already exists, return with error code 1 */ IF (@LoginIDExists = @LoginID) BEGIN SELECT 1 RETURN END ELSE BEGIN /* The loginID does not already exist, attemp to add the new user to the database. */ INSERT INTO users ( loginID, loginpassword, registerDate ) VALUES ( @LoginID, @Password, @RegisterDate ) /* Grab the UserID for the new user. */ SELECT @UserID = @@identity /* return with error code 0 */ SELECT 0 RETURN ENDGO [/pre]
I'm wondering if anyone has a written project plan for upgrading a server to 7.0 from 6.5. I'm looking to make this upgrade myself shortly. I would appreciate any dialog, or a written working plan. Thanks,
Mark Blackburn o `"._ _ M onterey mark@mbari.org o / _ |||;._/ ) B ay Science at its Best! ~ _/@ @ /// ( ~ A quarium (831) 775-1880 ( (`__, ,`| R esearch http://www.mbari.org/ '.\_/ |\_.' I nstitute
Database Administrator MBARI Personal Web Page: http://www.mbari.org/~mark/
I have a transaction table which has Date as datetime field, amount and account number. i want to find out count of checks that were written in a period of 4 days which exceeded i.e. > $400, between 401 and 500, > 501 for a single month. the table has data for more than a year and i want the results then grouped in monthly format like in OCT between 300 & 400 #30 (30 customers gave checks total worth $300-$400 within any 4 consecutive days period in the month of OCT ) between 400 & 500 # 20 > 501 # 10
NOV between 300 & 400 #30 between 400 & 500 # 20 > 501 # 10
I've a table with a nvarchar(max) column on Filegroup2. While inserting a lot of big datas (Word documents, each 2.5MB), the primary filegroup is growing - but the Filegroup2 remains still on its creation size.
Is that a bug? By the way, i ve dropped the table and recreated on the other filegroup, after that i've restartet the SQL 2005 Service.
Hey guys, I had purchased a program that generates full operational asp.net pages from an access db. I was unfamiliar with the language, and so that was the route I took. After disecting it and studying I've learned a bit and made it work in my environment. However, I now need to migrate everything over to mssql. I got the db portion down and now I'm trying to modify my scripts to point to a sql db rather than an access db. I thought it was going to be relatively simple but it's proving to be quite a challenge for me.Was wondering if anyone could check my work. The original access driven page had the following connection strings.vb page had [ public strConn as string="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("../") & "/db/db.mdb"end class]and in my aspx. pages I hadAccessDataSourceControl1.selectcommand="SELECT * FROM table "AccessDataSourceControl1.ConnectionString = strConn My new page now has the following.I got rid of the .vb page and put this in. Dim myConnection as New SqlConnection("Server=mysqlserver;Database=db;UID=myusername;PWD=my pw;") Const strSQL as String ="SELECT * FROM table" Dim myCommand as New SqlCommand(strSQL, myConnection)
further down I have a wmx data grid. I'm assuming I don't need to touch that but there is a line that has, <wmx:AccessDataSourceControl id="AccessDataSourceControl1" runat="server" ></wmx:AccessDataSourceControl> and I don't know what the equivilant of that is. I know its pointing to the accessdatasoucrcontrol1 that has the select command, but what would be the equivilant ofwmx:accessdatasourcecontrol?Also, is this the way to go? by that i mean, should I just rescript everything? Also, 1) Am I connecting to the sql db properly? 2) some sites say I have to put a connection string in the web.config file, is that true?3) Does any one have any references I can goto, I'm having some trouble finding a good article that lays down exactly what needs to go where in an sql asp.net environment. Thanks guys.
I added one crummy column to my table. I updated the stored procedure and added the thing to the aspx page which is my form for adding an article. I have a strong feeling that something is foul over here...Why is it that Visual Studio will not allow me to capitalize the word get and when I delete the () after ShortDesc they immediatlye reappear and the get statement is set to get. Every other one of them, and there are 9 others use GET and there is no () after the public property variable name. Does anyone know the reason for this? Public Property Author As System.String GETReturn _Author End Get Set(ByVal Value As System.String) _Author= ValueEnd Set End PropertyPublic Property ShortDesc() As System.String GetReturn _ShortDesc End GetSet(ByVal value As System.String) End Set End Property
I am beginning to write stored procedures for an application which is to be written in VB5. The stored procedures will be written in 6.5 but when the system goes live, we hope to upgrade to SQL server 7 What I want to know is what changes will I have to make to the stored procedures when I upgrade to 7.0?
I have a 3 data flows with an oledb source, a script component and a sql server destination that reports success and that it wrote the rows to the table in question. However, the rows are not written to the SQL Server 2005 table that is the destination. I have many other data flows in the same package that work exactly the same way that insert the rows they should insert in the destination table.
An example of the message I get indicating success is as follows:
[DTS.Pipeline] Information: "component "SQL Server Destination" (75)" wrote 289 rows.
Has anyone else seen this behavior or have an idea what might be wrong? Why would the data flow report success when the rows were not, in fact, inserted in the destination table?
We're trying to launch a SSIS package throw a webservice. This WebService loads a configuration file with "myPackage.ImportConfigurationFile(pathConfig)" and assigns values to some variables with "myPackage.Variables.Item(Parameters.Keys.Item(i)).Value = Parameters.Item(i)". Seems to work.
I we execute the webmethod of the WebService, this works but only when we execute first time, the SSIS finished succesfully. But when we execute a second time the Webmethod, we've a lot of failure with messages:
The result of the expression "@[User::Email]" on property "ToLine" cannot be written to the property. The expression was evaluated, but cannot be set on the property.The result of the expression ""The Import of " + @[User::ExcelFile]+ " is successful"" on property "MessageSource" cannot be written to the property. The expression was evaluated, but cannot be set on the property.
acutally i have setup a Disaster Recovery plan for my database.. i m taking a full back once in a week,. i dont' know when i right click on the job and trying to check the view history option to check when was last backup has been taken, it's showing nothing..but when i check on acutall location the backup was taken there.. i don't know y it's not writing any info in view history table.. or is it clear once in a week and i cann't see that...
ok. the problem: some tables are empty, so i can't be sure why some are updating at the DB and some arent. I have manually picked thru every line of the xml that i'm reading into the dataset here, and it is fine, data is all valid and everything. the tables i'm most worried about are bulletins and surveys, but they all have to be imported from my upload, the code steps thru just fine and I've been thru it a million times. Did I miss something in my dataadapter configuration?. 'daBulletin ' Me.daBulletin.ContinueUpdateOnError = True Me.daBulletin.DeleteCommand = Me.SqlDeleteCommand17 Me.daBulletin.InsertCommand = Me.SqlInsertCommand17 Me.daBulletin.SelectCommand = Me.SqlSelectCommand25 Me.daBulletin.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "tblBulletin", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("BulletinID", "BulletinID"), New System.Data.Common.DataColumnMapping("ContractID", "ContractID"), New System.Data.Common.DataColumnMapping("Msg_Type", "Msg_Type"), New System.Data.Common.DataColumnMapping("DatePosted", "DatePosted"), New System.Data.Common.DataColumnMapping("Subject", "Subject"), New System.Data.Common.DataColumnMapping("B_Body", "B_Body"), New System.Data.Common.DataColumnMapping("I_Read_It", "I_Read_It"), New System.Data.Common.DataColumnMapping("DateRead", "DateRead")})}) Me.daBulletin.UpdateCommand = Me.SqlUpdateCommand16 here is my merge function: Private Function Merge(ByVal sFilename As String, ByVal User As String) As String Dim connMerge As New SqlConnection(ConnectionString) Dim dsNew As New dsBeetleTracks Dim dsExisting As New dsBeetleTracks Dim strResult As String SetConnections(connMerge) Dim idc As New System.Security.Principal.GenericIdentity(User) Dim currentUser As BeetleUser = bu
dsNew.ReadXml(sFilename)
If currentUser.IsInRole("Admin") Or currentUser.IsInRole("QA") Then If dsNew.tblBulletin.Count > 0 Then daBulletin.Fill(dsExisting.tblBulletin) dsExisting.Merge(dsNew.tblBulletin) strResult += daHelipads.Update(dsExisting.tblBulletin).ToString + " Bulletins updated<br>" End If End If
If dsNew.tblHours.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("Admin")) Then daHours.Fill(dsExisting.tblHours) dsExisting.Merge(dsNew.tblHours)
strResult += daHours.Update(dsExisting.tblHours).ToString + " hours updated<br>" End If
If dsNew.tblHeliPads.Count > 0 Then daHelipads.Fill(dsExisting.tblHeliPads) dsExisting.Merge(dsNew.tblHeliPads) strResult += daHelipads.Update(dsExisting.tblHeliPads).ToString & " helipads updated " End If
If dsNew.tblExpenses.Count > 0 Then daExpenses.Fill(dsExisting.tblExpenses) dsExisting.Merge(dsNew.tblExpenses)
strResult += daExpenses.Update(dsExisting.tblExpenses).ToString + " expenses updated<br>" End If
If dsNew.tblPersons.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn")) Then daPersons.Fill(dsExisting.tblPersons) dsExisting.Merge(dsNew.tblPersons) strResult += daPersons.Update(dsExisting.tblPersons).ToString + " persons updated<br>" End If
If currentUser.IsInRole("Field") Then daSurveys.SelectCommand.CommandText = "exec Surveys_Field_Select" daSurveys.InsertCommand.CommandText = "exec Surveys_Field_Insert" daSurveys.UpdateCommand.CommandText = "exec Surveys_Field_Update" End If
If dsNew.tblSurveys.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("Field")) Then ' Or CurrentUser.IsInRole("Admin")) Then
strResult += daSurveys.Update(dsExisting.tblSurveys).ToString + " surveys updated<br>" End If
If dsNew.tblSurveyChecks.Count > 0 And (currentUser.IsInRole("QA") Or currentUser.IsInRole("Admin")) Then daSurveyChecks.Fill(dsExisting.tblSurveyChecks) dsExisting.Merge(dsNew.tblSurveyChecks)
strResult += daSurveyChecks.Update(dsExisting.tblSurveyChecks).ToString + " survey checks updated<br>" End If
If dsNew.tblTreatments.Count > 0 And (currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn")) Then ' Or CurrentUser.IsInRole("Admin")) Then daTreatments.Fill(dsExisting.tblTreatments) dsExisting.Merge(dsNew.tblTreatments)
strResult += daTreatments.Update(dsExisting.tblTreatments).ToString + " treatments updated<br>" End If
If dsNew.tblInternalQC.Count > 0 And (currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn") Or currentUser.IsInRole("Survey")) Then ' Or CurrentUser.IsInRole("Admin")) Then daInternalQC.Fill(dsExisting.tblInternalQC) dsExisting.Merge(dsNew.tblInternalQC)
strResult += daInternalQC.Update(dsExisting.tblInternalQC).ToString + " internalqc updated<br>" End If
If dsNew.tblTreatmentChecks.Count > 0 And (currentUser.IsInRole("QA") Or currentUser.IsInRole("Admin")) Then Try daTreatmentChecks.Fill(dsExisting.tblTreatmentChecks) dsExisting.Merge(dsNew.tblTreatmentChecks) strResult += daTreatmentChecks.Update(dsExisting.tblTreatmentChecks).ToString + " treatment checks updated<br>" Catch dbex As DBConcurrencyException strResult += vbCrLf & dbex.Message For x As Integer = 0 To dbex.Row.Table.Columns.Count - 1 strResult += vbCrLf & dbex.Row.GetColumnError(x) Next End Try End If
If dsNew.tblHeliPiles.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then ' Or CurrentUser.IsInRole("Planner")CurrentUser.IsInRole("QA") Or CurrentUser.IsInRole("Admin") Or daHeliPiles.Fill(dsExisting.tblHeliPiles) dsExisting.Merge(dsNew.tblHeliPiles)
strResult += daHeliPiles.Update(dsExisting.tblHeliPiles).ToString + " piles updated<br>" End If
If dsNew.tblHeliCycles.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then ' CurrentUser.IsInRole("Planner") Or Or CurrentUser.IsInRole("Admin")) Then daHeliCycles.Fill(dsExisting.tblHeliCycles) dsExisting.Merge(dsNew.tblHeliCycles)
strResult += daHeliCycles.Update(dsExisting.tblHeliCycles).ToString + " cycles updated<br>" End If
If dsNew.tblHeliTurns.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then 'CurrentUser.IsInRole("Admin") Or CurrentUser.IsInRole("Planner") Or daHeliTurns.Fill(dsExisting.tblHeliTurns) dsExisting.Merge(dsNew.tblHeliTurns)
strResult += daHeliTurns.Update(dsExisting.tblHeliTurns).ToString + " turns updated<br>" End If
If dsExisting.HasChanges Then dsExisting.Merge(dsNew) End If dsExisting.AcceptChanges()
'duh. 'If dsNew.HasChanges Then ' dsNew.AcceptChanges() 'End If If dsExisting.HasErrors Then Dim bolError As Boolean Dim tempDataTable As DataTable bolError = True
strResult += "<br>"
For Each tempDataTable In dsExisting.Tables If (tempDataTable.HasErrors) Then strResult += PrintRowErrs(tempDataTable) End If Next End If
dsNew.Dispose() dsExisting.Dispose() connMerge.Close() 'edebugging will only track strresult Dim fsError As New FileStream(Server.MapPath("./incoming/error.txt"), FileMode.Create, FileAccess.Write) Dim swError As New StreamWriter(fsError) swError.WriteLine("--==ERROR LOG==--") swError.WriteLine(Now.Date.ToShortDateString) swError.WriteLine("-----------------") swError.WriteLine(strResult) swError.Close() fsError.Close()
SS 2005 64Bit SP2 Hello Chaps Intermittent problem with the SQL Agent job history not getting written to the history table. Background:Today we noticed the account SQL Agent runs under cropping up in sp_who2. A quick check of the activity monitor said nothing was running. We ran a trace and, based on the SQL being executed, had a word with one of the developers who confirmed they had manually executed one of the jobs. There was no record anywhere that the job had run. There has been an issue with this particular job, when executed by this user, not showing up in history before but, as mentioned, this had been intermittent and we thought that a restart of the service had sorted it. Stuff run to try to track the job:EXEC sp_help_jobactivity @job_name = 'MyJob' EXEC sp_help_jobhistory @job_name = 'MyJob' SELECT *FROM dbo.sysjobhistory WHERE job_id = 'MyJob GUID'The first returned a row with no details in the columns indicating activity (e.g. last_executed_step_date and other columns were null). sp_help_jobhistory had some historical records but nothing since mid last month. sysjobhistory correlated with sp_help_jobhistory as you would expect. Right clicking the job in SSMS and viewing history correlated with sp_help_jobhistory (i.e. some records but nothing since mid-June). We edited the SQL in the job step and got the developer to rerun the job and, typically, everything appeared as it should in all the above result sets.Obviously this is tricky to track down since it has been intermittent but does anyone recognise anything that I have described above? I have of course googled but there doesn't really seem to be anything about it. We have considered there may be a problem in MSDB and may try running CHECKDB to see if anything comes up but somehow I doubt it will. Ta!
I added the subquery and now this thing consistently takes more than five minutes to return 7100+ rows. Any suggestions? Thanks again, you guys are the best.
ddave ---------------------------- SET @StrQry1 = '(SELECT 1 AS Counter, Q1.SubsidyLevel, VEL.* FROM dbo.ViewEligibilityPHC VEL LEFT OUTER JOIN (SELECT * FROM dbo.MEMB_LISHISTS l WHERE l.LISThruDate is null AND l.Deleted = ''0'') AS Q1 ON VEL.MEMBID = Q1.MemberID WHERE VEL.OPTHRUDT is null AND VEL.OPT LIKE ''' + @HPlan + ''' AND (VEL.PCP IS NULL OR VEL.PCP LIKE ''' + @Prvdr + ''') AND VEL.HCC LIKE ''' + @HCC + ''' AND (VEL.CaseMgrID IS NULL OR VEL.CaseMgrID LIKE ''' + @CaseMngr + ''') AND VEL.OPFROMDT <= CAST(''' + @SDate + ''' AS datetime) AND ISNULL(VEL.OPTHRUDT, CAST(''' + @TDate + ''' AS datetime)) >= CAST(''' + @EDate + ''' AS datetime)) '
does anybody know, is there any possible way to connect to database written in Natural ?? After evaluating everyday backups on that database all i can see is BCK data format. im trying to create datawarehouse running on sql server 2000 and gather all operational data from the systems that are working in my firm. I just managed to get data originating from Interbase and these with dbf and txt format . unfortunatelly my problem with bck data format is still open. As you can see im a beginner with that issue so if anybody could help i would be very gratefull.
Hi,I'm trying to write a java.sql.Date to a database and the minutes/seconds etc. are not being written. I've seen and tested manyexamplesfound via searches and still have come up with nothing. Here's what Ihave:java.sql.Date formation - recommended constructor forms:java.sql.Date entryDttm = newjava.sql.Date(System.currentTimeMillis());ORjava.sql.Date entryDttm = new java.sql.Date(newjava.util.Date().getTime());// prepared statement insertpstmt.setDate(1, entryDttm);// what is written to database2007-02-07 12:00:00.000// what needs to be written2007-02-08 09:37:25.793The above date value is written when I insert using the SQL methodGETDATE()The field is stored in a MS SQL Server 8.0 database and is defined asa 'datatime' or 'smalldatetime' field.How can I replicate the results of GETDATE() into 'datetime' and'smalldatetime' fields ina MS-SQL Server database (or is it possible?). Would a timestampdatatype make more sense?I'm using MS_SQL Server JDBC drivers.Any advice would be GREATLY appreciated!
How can I declare output parameter in stored procedure, written in C++/CLR? In C# it is proc_name( out SqlInt32 value ). In VB.NET it is proc_name( <Out()> ByRef value As SqlInt32 ). And in C++ ?
I'm trying to add exernal functions defined by a third party in a dll. They developed the dll in Visual C++ and is provided as is, with very little additional info about the code. The dll is tested and can be integrated into an application developed with VB.NET but no other experiences are available. I tried to add the functions to SQL Server 2005 Express edition but on attempting to CREATE the ASSEMBLY i get the following error: CREATE ASSEMBLY for assembly 'ThirdPartyDll' failed because assembly 'ThirdPartyDll' is malformed or not a pure .NET assembly. Unverifiable PE Header/native stub. No rows affected. (0 row(s) returned) @RETURN_VALUE = -6 Finished running [dbo].[ThirdPartyDll].
Is there an alternative way to add these functions for non pure .NET assemblies, or in general, is there a workaround to solve the problem?
By the way, do i need to register the dll with RegSvr32 first?
where in sql server 2005 ( and 2000 for that matter) do i find the path to the location where backups are placed (.bak files)? is there sql i can use to find this out
I have a problem with an existing stored procedure that is used to insert a new entry to a table (using an Insert statement).
I have been using the @@Identity global variable to return the identity column (id column) back to the calling routine. This has worked fine for years until recently an ‘after insert Trigger’ has been added to the table being updated.
Now the @@Identity is returning the identity value of the trigger that was called instead of the original table insert.
Does anyone know how I can code around this issue (without using a select statement within my stored proc, as these have been known to cause locks in the past).
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
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?
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.
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?