Posts

Showing posts with the label sql

SharePoint – The current operation could not be completed. Try again, or contact your system administrator.

If attempting to utilize Site Manager, to COPY an entire site or any particular pages, and receive the following error. The current operation could not be completed. Try again, or contact your system administrator. You may re-try the operation, and you may need to clean up the half-created data first before re-trying. If the problem persists, please contact your system administrator. If you review the logs, and the following is displayed, System.ArgumentException (0×80070057) Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder) at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder) at Microsoft.SharePoint.SPWeb.GetFileOrFolderObject(String strUrl) at Microsoft.SharePoint.Publishing.CommonUtilities.GetFile...

SQL – Locked in Single-User Mode

If you ever want to see what sessions are active in SQL, or if you ever perform a SharePoint Backup through Central Administration, and SQL Server goes into single-user mode and does not remove that state – the following SQL query will return all active user sessions, by ID. select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid where d.name = 'db_name' GO Once you get this ID, you can just manually kill the session, to the ID, and then disable single-user mode in the respective tables, etc.

NewsGator / SharePoint 2010 - Error Accessing Farm

When attempting to install NewsGator into a SharePoint 2010 Farm Environment, you may encounter the following error, when the installer checks the SharePoint version: Unable to access the farm. To resolve the error, make sure your account is logged into an account that has access to the SharePoint Farm SQL instance, as well as, a SharePoint Farm Administrator role.

C# / Threading - Progressbar with Database Transactions

To some, threading can be slightly confusing. If you happen to want to do a transaction on the computer you are writing the application for that may take a while, whether it be a database, communication with some PLC, saving large files, and happen to want to include a Progressbar, this sample may help. I am not going to step much into handling stepping with Progressbars, but rather the threading. It was found that thread pools are easily the ' weapon of choice ' when it comes to processing asynchronous I/O, post work items, etc. If you don't use threading, you may see that your application locks up for the length of time it takes to process these transactions. In terms of code, you do the following: using (SqlConnection sqlConn = new SqlConnection(String.Format("Data Source = {0}; User Id = {1}; Password = {2}; Timeout = 0; Integrated Security = True;", cboDatasources.SelectedItem.ToString(), txtUserName.Text, txtPassword.Text))) { // Open SQL Connection ...

SQL - Finding SQL Server Installation Path

If trying to automate creating databases you may need to get the installation path of the SQL Server instance you are connected to, to do this use the following query. declare @rc int, @dir nvarchar(400) exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\Setup', N'SQLPath', @dir output, 'no_output' select @dir AS InstallationDirectory

C# - Finding SQL Server Data Sources and Databases

For those exploring how to finding data sources, database names, etc - using C#, you can do the following: // Retrieve the enumerator instance, and then retrieve the data sources. SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance; DataTable dtDatabaseSources = instance.GetDataSources(); // Populate the data sources into DropDownList. foreach (DataRow row in dtDatabaseSources.Rows) if (!string.IsNullOrWhiteSpace(row["InstanceName"].ToString())) cboDatasources.Items.Add(row["ServerName"].ToString() + "\\" + row["InstanceName"].ToString()); The code above however, did not show the local instances of SQL Server 2008 R2. So, to acquire your local instances as well, you will need to use the SMO ManagedComputer object, which provides an interface to the WMI Provider for Configuration Management. You will need to add the following references to the project (using VS2010), in C:\Program Files...

SQL - Inserting Images

If there is ever a need to store images into SQL Server, it can be done in a few simple steps; you will need to create the database, the table names and insert your images. CREATE TABLE ImageResource ( ID INT(5) NOT NULL AUTO_INCREMENT, NAME NVARCHAR(255) NULL, IMAGE IMAGE NULL, PRIMARY KEY ('ID') ); Once the table has been created, you simply do the insert via the following: INSERT INTO dbo.ImageResource (NAME, IMAGE) SELECT 'LOGO_NAME' AS NAME, * FROM OPENROWSET (BULK N'C:\FILENAME.PNG', SINGLE_BLOB) AS IMAGE If the image needs to be updated, use the following: UPDATE dbo.ImageResource SET IMAGE = ( SELECT * FROM OPENROWSET(BULK N'C:\FILENAME.PNG', SINGLE_BLOB) AS IMAGE ) WHERE NAME = 'LOGO_NAME'

SQL Server Business Intelligence - Lost Report Data Window

In an unlikely circumstance that you happen to lose the Report Data Window , in SQL Server Business Intelligence, you won't simply find it in your VIEW menu options. There is a simple keyboard shortcut to re-create this window, which is CTRL+ALT+D .