Hey, ive got a listof events that have occured on my site, updates etc. and Im trying to show how long ago the updates happened. For instance, say the date of an update is : 16/10/2007 15:16:03 I want the Label to say "Happened over 2 months ago" etc.Now ive tryed to use an IF statment but I cant seem to get it right : DateTime dt = Convert.ToDateTime("16/10/2007 15:16:03"); if(dt.ToShortDateString() == DateTime.Now.ToShortDateString()) { //happened today if(dt.ToShortTimeString() == DateTime.Now.ToShortTimeString()||dt.ToShortTimeString() < DateTime.Now.AddMinutes(-1).ToShortTimeString()) { //happened within a minute UpdateLabel.Text = "About A Minute Ago"; } } else if (dt.ToShortTimeString() == DateTime.Now.AddDays(-1).ToShortTimeString()) { //happened yesturday UpdateLabel.Text = "Updated Yesturday"; } else if (dt.ToShortDateString() == DateTime.Now.ToShortDateString() || dt.ToShortDateString <= DateTime.Now.AddDays(-7).ToShortDateString()) { UpdateLabel.Text = "Updated Last Week"; }Any ideas where Im going wrong? Im probally staring it straight in the face, but I cant see it. Thanks in advance John
In MOC (SQL 7.0 Implemetation), it says there will be rollback, but in my humbel opinion, there should be nothing happened.
I think there was no dirty writing in this case. No data pages written, no log pages written to disk. Am I right? Then, there might be nothing happened instead of ROLLBACK.
If I am wrong, would you please let me know what is wrong in my thougt?
I am using SQL Server 6.5, when two or more independent applications put transactions through SQL, it locks up. Example of locks up.
When the OrderLines table is locked, then I put the following (Select * from OrderLines) then the query does not return any values, the world goes round and round, the only way out is to shut down and cross my fingers whilst SQL goes into recovery mode.
I have read through some of the documentation, such as deadlocks, livelocks and lock starvation but it say none of these will lock the whole machine. But somehow simultaneous transactions can, and the current activity dialog goes red, bright red.
I have a SQL 2000 server(sp2) on Win2000 SP2. My largest database is about 5 gig. Log shipping went astray and had to reinitialize. WHen I did the part where it actually backups the init db to disk failed with the following
3041 : BACKUP failed to complete the command BACKUP DATABASE [Development] TO DISK = N'G:SQLBACKUPdevlog' WITH INIT , NOUNLOAD , NAME = N'Development backup', NOSKIP , STATS = 10, NOFORMAT
In the NT event log I got the following
{Lost Delayed-Write Data} The system was attempting to transfer file data from buffers to DeviceLanmanRedirector. The write operation failed, and only some of the data may have been written to the file.
HiWe have a SQL 2000 (sp3) server with a database that I set up to have theMDF on D: and the LDF on E:. All was going along fine for several months andone day the server rebooted. The SQL log says something like "Service isshutting down due to server shutdown."When it came back up the LDF File was on D: (in the same folder as the MDF).The original LDF was gone from E:The SQL Log doesn't ever say anything like "Recreating LDF in defaultlocation." or any anything else that would explain what happened.I assume the change happened during the reboot (actually I didn't notice ituntil a week and a half later). I am relatively sure no human did anythingthat caused the log file to move.So has anyone seen this happen before.?TIA-Dick
I'm relatively new to SSIS - i've played with the technology a little and i've created some DTS packages previously.
I'm in a scenario where I have 3 servers with an instance of SQL 2005 installed. Server A is a live server with lots of statistical data, Server B is a backend server specifically provided for handling heavy data processing. Server C is another live server, but it's essentially empty.
I would like to transfer some data from Server A, summarise it using the processing power of Server B and then store the resulting summary data in Server C. One of my main requirements is to have minimum processing performed on Server A and C.
I created an SSIS package which produces the required results, but I've no real idea where the hard work is being performed. For example, in my SSIS i have an OLEDB data source which uses a select statement with a couple of parameters to determine which data to return from Server A, i then have an aggregate transformation on the output before an OLEDB data destination for Server C. So where does the aggregation get performed?
Im hoping because i'm running my SSIS package on Server B that in the above instance, all the source data is pulled onto Server B (maybe into a tempdb?) and then aggregated by Server B before then being transferred onto Server C.
Please let me apologise in advance for the lengthy post - but just trying to explain this to others may help me work it out in my head (at the very least)
im using Vb2005 and Sql server 2000.when i open enterprise manager n try to make the connection, then i got error msg like this" A connection could not be established to (LOCAL)Reason: SQL server does not exists or access denied.ConnectionOpen (Connect()) ..Please verify SQL Server is running and check your SQK Server registration properties (by right-clicking on the (LOCAL) node) and try again" When i open sql server service manager and try to start my sql, its do not change from stop to start.. and one more thing is, if i plan to use sql server 2005..do i need to uninstall sql server 2000?
Hi,I am trying to debug some queries that are being generated by anexternal program, and I have no way of finding out what the actualsyntax of the query is from within the program itself. This means thatwhen the query fails I am left with only a very unhelpful message.So what I was wondering, was whether there is a way that I can view theactual queries that are sent to SQL server as they happen, or if areal-time solution doesn't exist, then some way I can look back afterthe event and see the syntax of the queries?Ideally, what I would like to do is see the queries in the form theywere sent to the server, ie "SELECT * FROM foo WHERE bar='foobar'", asthis would help me to figure out where the generated queries are goingwrong.Cheers,--Dylan Parryhttp://electricfreedom.org | http://webpageworkshop.co.ukThe opinions stated above are not necessarily representative ofthose of my cats. All opinions expressed are entirely your own.
I got the following message..What does it mean and where it happens? By reading few articles it seems that if the Rollback is not the first statement within the catch block, then this error might occur. However I want to know why it happens? I am not using any trigger in my app.
Hello! I have a web form in VB.NET & ASP.NET 1.1, with data being saved to a SQL 2005 database with multiple tables. The primary key on all these tables is a unique identifying number that the user enters. However, one record in this database (across all tables) has no identifier. All other information seems to have saved without problem, but there's no identifier, which is very wierd for several reasons: 1) the form should not allow the user to proceed without it; 2) all the tables in the database do not allow nulls for the column, and 3) it's the primary key! Any thoughts on how this might have happened? Thanks! Kaiti
Ok, here is my situation..... When someone navigates to a user's profile page on my site, I present them with a slideshow of the user's photos using the AJAX slideshow extender. I obtain the querystring value in the URL (to determine which user's page I'm on) and feed that into a webservice via a context value where an array of photos is created for the slideshow. Now, in order to create the array's size, I do a COUNT of all of that specific user's photos. Then, I run another SQL statement to obtain the path of those photos in the file system. However, during the time of that first SQL query's execution (the COUNT statement) to the time of the second SQL query (getting the paths of the photos), the owner of that profile may upload or delete a photo from his profile. I understand this would be a very rare occurrence since SQL statements 1 and 2 will be executed within milliseconds of each other, but it is still possible I suppose. When this happens, when I try to populate the array, either the array will be too small or too large. I'm using SqlDataReader for this as it seems to be less memory and resource intensive than datasets, but I could be wrong since I'm a relative beginner and newbie. This is what I have in my vb file for the webservice.....Public Function GetSlides(ByVal contextKey As String) As AjaxControlToolkit.Slide() Dim dbConnection As New SqlConnection("string for the data source, etc.") Try dbConnection.Open() Dim memberId = CInt(contextKey) Dim photoCountLookupCmd As New SqlCommand _ ("SELECT COUNT(*) FROM Photo WHERE memberId = " & memberId, dbConnection) Dim thisReader As SqlDataReader = photoCountLookupCmd.ExecuteReader() Dim photoCount As Integer While (thisReader.Read()) photoCount = thisReader.GetInt32(0) End While thisReader.Close() Dim MySlides(photoCount - 1) As AjaxControlToolkit.Slide Dim photoLookupCmd As New SqlCommand _ ("SELECT fullPath FROM Photo WHERE memberId = " & memberId, dbConnection) thisReader = photoLookupCmd.ExecuteReader() Dim i As Integer For i = 0 To 2 thisReader.Read() Dim photoUrl As String = thisReader.GetString(0) MySlides(i) = New AjaxControlToolkit.Slide(photoUrl, "", "") Next i thisReader.Close() Return MySlides Catch ex As SqlException Finally dbConnection.Close() End Try End FunctionI'm trying to use the most efficient method to interact with the database since I don't have unlimited hardware and there may be moderate traffic on the site. Is SqlDataReader the way to go or do I use something else? If I do use SqlDataReader, can someone show me how I can run those 2 SQL statements in best practice? Would I have to somehow lock writing to that table when I start the first SQL statement, then release the lock after I execute the second SQL statement? What's the best practice in this kind of scenario. Thanks in advance.
I want to change Startup Service Account of an instance on SQL Server 2000 from System Account to a Domain Account from Enterprise Manager. What impact maybe bring up on database and frond end?
We are using SQL 2005 for maintaing the Poerplant database,for that we have to run reports to get the data from the database.We have selected "RecoveryModel" is Simple.but if we select recovery model "Simple" we cannot get the full Database backup.And if we select the Recovery Model is "Full" the size of transaction log files for historical database is growing like anyway.So what i think that if we choose recovery model as "Simple" the size of transaction log files will be in controlable size.But if select Recovery model is"Full" then the size of transaction logfiles are growing.
Hi,Before stepping into ado.net code to perform an insert or update, the insert / update has already taken place, just on starting the debugger. I use VS 2005 on SQL Server 2000. This did not happen with VS 2003 and SQL Server 2000.Anyone else encountered this?
I'm exploring using VS2013, TFS 2013 and Release Management for DB projects.In VS 2013 the deployment configuration is stored in the publishing profile, which is not necessarily being used by deployment tools. (Release Management for example, while it's supporting the profiles, it does not require them) So, the question is how to control what will happen in the target database when the publishing profile file is not being used?
Is there any way to store the deployment configuration with project so it will be applied by default?For example, if I want to control the following settings: Block incremental deployment if data loss may occur...Drop objects in the target DB that are not in the DB project, e.t.c.
As we all know that cluster index physically sort the table. Now what will happen if I insert a new row in the table which voilating the sort rule of table. Will it inserte at the end of table or table is reordered as cluster index always keep table in physically sorted . Please cleaar my doubt.
Our report server are constantly getting the below error.
What causes this - I know how to fix it, in fact, I've automated it but why does it constantly happen on some servers? I guess I'd like to know what causes it to try and fix it at those points instead of having to fix it here. Proactively.
Reporting Services Error
The report server cannot decrypt the symmetric key used to access sensitive or encrypted data in a report server database. You must either restore a backup key or delete all encrypted content. Check the documentation for more information. (rsReportServerDisabled) (rsRPCError) Get Online Help
The report server cannot decrypt the symmetric key used to access sensitive or encrypted data in a report server database. You must either restore a backup key or delete all encrypted content. Check the documentation for more information. (rsReportServerDisabled)
The report server cannot decrypt the symmetric key used to access sensitive or encrypted data in a report server database. You must either restore a backup key or delete all encrypted content. Check the documentation for more information. (rsReportServerDisabled)
I have a FTP task in my control flow that download files from a FTP server. This ftp task is inside a foreach container that loops over a ADO recordset for the file name. The files that the ftp task pulls are huge. If the FTP task fails then I want the FTP task to restart and only download those files that have not been downloaded. Is this possible?
What possible configurations do I have to make to the foreach container and the filetask?
Hi all, There is nothing happen when I finished my checkout process, I expect the data will be saved to order and orderitem table in my SQL database, but no data found on order and orderitem table and no error messages display during operation!!! Below is my checkout.aspx.vb code, the whole code line number around 138, I captured the part from 1~ 64 line number, I suspect line 35 - 48 have a problem, can somebody help me, many thanks. 1 Imports System 2 Imports System.Data.SqlClient 3 Imports SW.Commerce 4 Partial Class CheckOut 5 Inherits System.Web.UI.Page 6 Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 7 If Not Page.IsPostBack Then 8 If Profile.Cart Is Nothing Then 9 NoCartlabel.Visible = True 10 Wizard1.Visible = False 11 End If 12 If User.Identity.IsAuthenticated Then 13 Wizard1.ActiveStepIndex = 1 14 Else 15 Wizard1.ActiveStepIndex = 0 16 End If 17 End If 18 End Sub 19 Sub chkUseProfileAddress_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) 20 21 ' fill the delivery address from the profile, but only if it’s empty 22 ' we don’t want to overwrite the values 23 24 If chkUseProfileAddress.Checked AndAlso txtName.Text.Trim() = "" Then 25 txtName.Text = Profile.Name 26 txtAddress.Text = Profile.Address 27 txtcity.Text = Profile.City 28 txtCountry.Text = Profile.Country 29 End If 30 End Sub 31 Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) 32 33 ' Insert the order and order lines into the database 34 35 Dim conn As SqlConnection = Nothing 36 Dim trans As SqlTransaction = Nothing 37 Dim cmd As SqlCommand 38 Try 39 conn = New SqlConnection(ConfigurationManager.ConnectionStrings("swshop").connectionstring) 40 conn.Open() 41 trans = conn.BeginTransaction 42 cmd = New SqlCommand() 43 cmd.Connection = conn 44 cmd.Transaction = trans 45 46 ' set the order details 47 48 cmd.CommandText = "INSERT INTO Order(MemberName, OrderDate, Name, Address1, Address2, Country, Total) VALUES (@MemberName, @OrderDate, @Name, @Address, @city, @Country, @Total)" 49 cmd.Parameters.Add("@MemberName", Data.SqlDbType.VarChar, 50) 50 cmd.Parameters.Add("@OrderDate", Data.SqlDbType.DateTime) 51 cmd.Parameters.Add("@Name", Data.SqlDbType.VarChar, 50) 52 cmd.Parameters.Add("@Address", Data.SqlDbType.VarChar, 255) 53 cmd.Parameters.Add("@City", Data.SqlDbType.VarChar, 15) 54 cmd.Parameters.Add("@Country", Data.SqlDbType.VarChar, 50) 55 cmd.Parameters.Add("@Total", Data.SqlDbType.Money) 56 cmd.Parameters("@MemberName").Value = User.Identity.Name 57 cmd.Parameters("@OrderDate").Value = DateTime.Now() 58 cmd.Parameters("@Name").Value = CType(Wizard1.FindControl("txtName"), TextBox).Text 59 cmd.Parameters("@Address").Value = CType(Wizard1.FindControl("txtAddress"), TextBox).Text 60 cmd.Parameters("@City").Value = CType(Wizard1.FindControl("txtCity"), TextBox).Text 61 cmd.Parameters("@Country").Value = CType(Wizard1.FindControl("txtCountry"), TextBox).Text 62 cmd.Parameters("@Total").Value = Profile.Cart.Total 63 Dim OrderID As Integer 64 OrderID = Convert.ToInt32(cmd.ExecuteScalar())
I tried to use dbo.tables of Northwind database in SQL Server Express to do SqlCommand to populate a DataTable in DataSet. The SqlCommand failed in the project execution and I found that Northwind database in SQL Server Express is busted and gone (just the name "Northwind" remained in the SQL Server Management Studio Express). How can I prevent it from happening in my "SqlCommand-SqlConnection" project? Please help and advise.
I tried to repair my "Northwind" database by using the SQL2000SampleDb.msi of Northwind and pubs Sample Databases for SQL Server 2000 downloaded from the http://www.microsoft.com/downloads. My "pubs" database is still in my SQL Server Management Studio Express. How can I just repair my "Northwind" database by using the Microsoft SQL2000SampleDb.msi program? Please help and advise this matter too.