If, when attempting to log in to SQL Server Management Studio you get an error
"Cannot open user default database. Login failed. Login failed for user 'UserName'. (Microsoft SQL Server, Error: 4064)",
click Options and in a dropdown Connect to database, type in your database name and click connect.
Friday, June 1, 2012
Saturday, May 5, 2012
How to utilize Microsoft SharePoint via Visual Studio .NET
First download appropriate installer for Visual Studio 2008 Extensions for Windows SharePoint Services 3.0
http://www.microsoft.com/en-us/download/details.aspx?id=14154 - VSeWWSv13_x64.exe
Then, download Windows SharePoint Services 3.0
http://www.microsoft.com/en-us/download/details.aspx?id=14117 - SharePoint.exe
If you attempt to install Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, it will ask you to first install Windows SharePoint Services 3.0, which, in turn, will give you an installation error. There is one thing you need to do before attempting to install Windows SharePoint Services 3.0: Run SharePoint on Vista Installation Helper File. It is created for Windows Vista, but works just fine on Windows 7 and can be downloaded from here
http://community.bamboosolutions.com/media/p/193/download.aspx
After downloading Vista Installation Helper File, run WssVista.msi.
After install is compete, run C:\Program Files (x86)\WssOnVista\Setup\SetupLauncher.exe and when it prompts, navigate to SharePoint.exe that you have downloaded in previous steps.
After all this is done, you can safely install Visual Studio 2008 Extensions for Windows SharePoint Services 3.0 - the first file you have downloaded.
Now, in order to add SharePint dll to your project, right-click on the Visual Studio project name, select Add Reference and browse to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll" and add Microsoft.SharePoint directove to your .NET class.
http://www.microsoft.com/en-us/download/details.aspx?id=14154 - VSeWWSv13_x64.exe
Then, download Windows SharePoint Services 3.0
http://www.microsoft.com/en-us/download/details.aspx?id=14117 - SharePoint.exe
If you attempt to install Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, it will ask you to first install Windows SharePoint Services 3.0, which, in turn, will give you an installation error. There is one thing you need to do before attempting to install Windows SharePoint Services 3.0: Run SharePoint on Vista Installation Helper File. It is created for Windows Vista, but works just fine on Windows 7 and can be downloaded from here
http://community.bamboosolutions.com/media/p/193/download.aspx
After downloading Vista Installation Helper File, run WssVista.msi.
After install is compete, run C:\Program Files (x86)\WssOnVista\Setup\SetupLauncher.exe and when it prompts, navigate to SharePoint.exe that you have downloaded in previous steps.
After all this is done, you can safely install Visual Studio 2008 Extensions for Windows SharePoint Services 3.0 - the first file you have downloaded.
Now, in order to add SharePint dll to your project, right-click on the Visual Studio project name, select Add Reference and browse to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll" and add Microsoft.SharePoint directove to your .NET class.
Thursday, May 3, 2012
Login failed for user [name] error
So you have been moving database from one server or instance to another, you backed up and restored the database, scripted all logins, did everything in the book, and suddently, when loging in with sql server login, that worked so well before, you get "Login failed for user [name]" error.
First thing to check is whether your SQL Server is configured to use Mixed mode or Windows only authentication. because if it is configured to use Windows only, any sql login will be rejected, no matter what type of permissions it has.
Right-click on the server name, go to Properties, select Security and make sure "SQL Server and Windows Authentication mode" is selected.
First thing to check is whether your SQL Server is configured to use Mixed mode or Windows only authentication. because if it is configured to use Windows only, any sql login will be rejected, no matter what type of permissions it has.
Right-click on the server name, go to Properties, select Security and make sure "SQL Server and Windows Authentication mode" is selected.
Wednesday, May 2, 2012
Moving databases: Detach/Attach method vs. Backup/Restore
Personally, when moving a database from one server to another, I prefer using backup/restore since if I encounter any issues with SQL Server versions or something else, I can always restore backup somewhere else and I will also have a working copy of the database on the source server, while if anything goes wrong during the detach/attach process, I will not have a copy of the database elsewhere. My second reason is that backup/restore requires no downtime, which is always a big plus.
So far I have encountered only one case where using detach/attach scenario was better then backup/restore - I needed to move a database from the default instance to a named instance on the same server and I did not want to use backup/restore since I wanted mdf and ldf files to stay at the same location on the server. Also detach/attach is much faster than backup/restore since it only takes minutes to detach database, copy the files to another server and attach the database, and both backup and restore processes can take hours.
So far I have encountered only one case where using detach/attach scenario was better then backup/restore - I needed to move a database from the default instance to a named instance on the same server and I did not want to use backup/restore since I wanted mdf and ldf files to stay at the same location on the server. Also detach/attach is much faster than backup/restore since it only takes minutes to detach database, copy the files to another server and attach the database, and both backup and restore processes can take hours.
Monday, March 26, 2012
SQL Server 2008: Owners vs. Schemas
The other day someone asked me what is dbo, they had trouble differentiating between dbo as object owner and dbo as a schema. That conversation was what inspired this post.
Every object created in SQL Server must have an owner and most of the time the owner is dbo, which is the database owner. One can easily determine the owner of a particular database object by looking at the fully qualified name which is using the following convention:
Example: Server03.Northwind.dbo.Customers, where dbo is the owner of table Customers that belongs to Northwind database that resides on Server03.
Object gets its owner based on who created the object. By default the user account that creates the object will also own the object and only users in db_owner role can create objects owned by dbo. Someone in db_owner role can create an object owned by any user in the database. Only objects created by members of the sysadmin fixed server role (or by the dbo user) belong to dbo. Objects created by any other user who is not also a member of the sysadmin fixed server role (including members of the db_owner fixed database role):
•Belong to the user creating the object, not dbo.
•Are qualified with the name of the user who created the object.
A schema is a named container for database objects, which allows you to group objects into separate namespaces. It is basically a way to logically group objects such as tables, views, stored procedures etc.
You can assign a user login permissions to a single schema so that the user can only access the objects they are authorized to access. Schemas can be created and altered in a database, and users can be granted access to a schema. A schema can be owned by any user, and schema ownership is transferable.
The dbo schema is the default schema for a newly created database. The dbo schema is owned by the dbo user account. By default, users created with the CREATE USER Transact-SQL command have dbo as their default schema.
Users who are assigned the dbo schema do not inherit the permissions of the dbo user account. No permissions are inherited from a schema by users; schema permissions are inherited by the database objects contained in the schema.
Before SQL Server 2005, schemas used to be equivalent to database users. Now each schema is a distinct namespace that exists independently of the user who created it. It can be owned by any user and its ownership is transferable.
Every object created in SQL Server must have an owner and most of the time the owner is dbo, which is the database owner. One can easily determine the owner of a particular database object by looking at the fully qualified name which is using the following convention:
Server.Database.ObjectOwner.DatabaseObject
Example: Server03.Northwind.dbo.Customers, where dbo is the owner of table Customers that belongs to Northwind database that resides on Server03.
Object gets its owner based on who created the object. By default the user account that creates the object will also own the object and only users in db_owner role can create objects owned by dbo. Someone in db_owner role can create an object owned by any user in the database. Only objects created by members of the sysadmin fixed server role (or by the dbo user) belong to dbo. Objects created by any other user who is not also a member of the sysadmin fixed server role (including members of the db_owner fixed database role):
•Belong to the user creating the object, not dbo.
•Are qualified with the name of the user who created the object.
A schema is a named container for database objects, which allows you to group objects into separate namespaces. It is basically a way to logically group objects such as tables, views, stored procedures etc.
You can assign a user login permissions to a single schema so that the user can only access the objects they are authorized to access. Schemas can be created and altered in a database, and users can be granted access to a schema. A schema can be owned by any user, and schema ownership is transferable.
The dbo schema is the default schema for a newly created database. The dbo schema is owned by the dbo user account. By default, users created with the CREATE USER Transact-SQL command have dbo as their default schema.
Users who are assigned the dbo schema do not inherit the permissions of the dbo user account. No permissions are inherited from a schema by users; schema permissions are inherited by the database objects contained in the schema.
Before SQL Server 2005, schemas used to be equivalent to database users. Now each schema is a distinct namespace that exists independently of the user who created it. It can be owned by any user and its ownership is transferable.
Thursday, March 8, 2012
Show and hide paragraphs using JQuery
Below is the JQuery code I used to show and hide paragraphs when user clicks on the hyperlink - paragraph title:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Test
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('p').hide();
//toggle the componenet with class msg_body
$('a.title').click(function() {
var res = this.id.substr(1);
$('#p' + res).slideToggle(500);
});
});
</script>
</head>
<body>
<a href="#" class="title" id="t1">Topic 1</a>
<p id="p1">Testing 1
</p>
<a href="#" class="title" id="t2">Topic 2</a>
<p id="p2">Testing 2
<a href="#" class="title" id="t3">Topic 3</a>
<p id="p3">Testing 3
</p>
<a href="#" class="title" id="t4">Topic 4</a>
<p id="p4">Testing 4
</body>
</html>
Tuesday, March 6, 2012
7 CSS3 properties one must know
- border-radius
with that one you can create rounded corners
-webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;
and even circles:-moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px;
- box-shadow
allows you to immediately apply depth to your elements
-webkit-box-shadow: 1px 1px 3px #292929; -moz-box-shadow: 1px 1px 3px #292929; box-shadow: 1px 1px 3px #292929;
or-webkit-box-shadow: 1px 1px 3px green, -1px -1px blue; -moz-box-shadow: 1px 1px 3px green,-1px -1px blue; box-shadow: 1px 1px 3px green, -1px -1px blue;
box-shadow accepts four parameters: x-offset y-offset blur color of shadow - text-shadow same as box-shadow but applied to text
-
.box { background: url(image/path.jpg) 0 0 no-repeat, url(image2/path.jpg) 100% 0 no-repeat; }In the case above, first background is placed in the top left position (0 0) and second - the top right position (100% 0) - background-size
background: url(path/to/image.jpg) no-repeat; -moz-background-size: 100% 100%; -o-background-size: 100% 100%; -webkit-background-size: 100% 100%; background-size: 100% 100%;
- text-overflow
text-overflow property can accept two values:
- clip
- ellipsis
.box { -o-text-overflow: ellipsis; text-overflow:ellipsis; overflow:hidden; white-space:nowrap; border: 1px solid black; width: 400px; padding: 20px; cursor: pointer; } - Resize
allows us to specify how a textarea is resized.
Possible values:
both: Resize vertically and horizontally
horizontal: Limit resizing to horizontally
vertical: Limit resizing to vertically
none: Disable resizing
textarea { -moz-resize: vertical; -webkit-resize: vertical; resize: vertical; }
Subscribe to:
Posts (Atom)