15 Dec 2011

My designs for libyan revolution

I designed some photos to our revolution













28 Sept 2010

SQL SERVER 2005- Error 18452

SQL SERVER 2005- Error 18452: login failed for user ' sa'. The user is not associated with a trusted SQL Server connection.
This error happens when I login using windows authentication that was successed, but when I tried to login using SQL Server authentication that was failed following by error message



To fix this problem
Following next steps:
1. Login using windows authentication.
2. Right Click on server name >> select Properties >> Click on Security tab>> select SQL Server and windows authentication mode >> Ok >> Restart SQL Server (Click on server name >> select Restart >> Yes >> Yes)



3. Security>> Logins >> Click on ‘sa’login >> Right Click on it>> select Properties>> In General tab>> type password and confirm it >> Click on Status tab>> In Login select Enabled>> ok



Now, login using SQL Server authentication that will login.

4 Nov 2009

SQL SERVER 2005- Error 18456: login failed for user

SQL SERVER 2005- Error 18456: login failed for user ' Computer name\ UserName'
This error happens when I run Microsoft SQL Server 2005 at first time with windows vista; I login using SQL Server authentication that was successed, but when I tried to login using windows authentication that was failed following by error message



To fix this problem
Following next steps:
1. Login using SQL Server authentication.
2. Security>> Logins >> New Login



3. In General
Login name= Computer name\ UserName
Select windows authentication



4. In Server Roles
Select sysadmin
>> ok



Now, login using windows authentication that will login.

20 Oct 2009

SQL Server 2oo8: Error 1326

This error happens when you want to connect to another server, due to the instance name does not exist and that SQL Server is configure to allow remote connection; the SQL Server could not connect following by error message



To fix this problem

Following next steps:
1-Control panel >> double click on firewall windows >> Exceptions tab>> add port.



2-Make port for SQL:
Name:SQL
Port:1433
>>ok



3-finally, a port appears.
Click ok.

19 Oct 2009

re-creation table in sql server 2008

How can we save changes that require table re-creation in sql server 2008?
When you work on sql server 2008 at first time to create table then want to change the type of field or rename.. ,after that you want to save, that will following by error message



To fix this problem
Following next steps:
1.Tools>>Options



2.Designers>>click on Table and Database Designers>>unchecked prevent saving changes that require table re-creation >>ok



Then you can change anything entire the table

1 Oct 2009

Convert From SQL Server 2005 to SQL Server 2008

I had tried to attach database in SQL Server 2008 which I was created it in SQL Server 2005, but the error happened when I added the .mdf file followed by error message



Then I imported the database from SQL Server 2005 to SQL Server 2008 through SQL Server 2008 that it works.
To Convert From SQL Server 2005 to SQL Server 2008
Following next steps:
1. Start >> all programs >>Microsoft SQL Server 2008 >> import and export data(64-bit)




2. SQL Server Import and Export Wizard appears
Click next.



3. Choose a data source
Data source: Select Microsoft OLEDB Provider for SQL Server.
Server Name: write the name of source server.
Authentication: choose Use SQL Server authentication, and write user name and password.
Database: Select the database name.
Click next.



4.choose a destination
Data source: Select SQL Server Native client 10.0.
Server Name: write the name of destination server.
Authentication: choose Use SQL Server authentication, and write user name and password.
•Database: Select the database name



0r if you want to create a new database click on new.
Write the name of new database >>ok
Click next.



5.specify table or query
Click next.



6.select source tables and views
Click next.



7. Save and run package
Select Run immediately >>click next.



8.to complete this wizard >>click finish



9.finally click on close

7 Sept 2009

SQL SERVER 2008-Error 916

SQL SERVER 2008- Error 916: The server principal "username" is not able to access the database "EmployeesDB" under the current security context.

This error happens when you want to connect remotely with database in SQL Server 2008 Management Studio which is following by error message



Notice: if you connect with SQL Server 2005 Management Studio, it will connect with database(no error message)

To fix this problem

Following next steps:

1. In Object Explorer, click on Databases.

2. View Object Explorer Details
(F7) or View >> Object Explorer Details.

3.Right click on the column headers and deselect
collation


4.Refresh Databases

Open Table in SQL Server 2008 Management Studio

SQL Server 2008 Management Studio replaced open table by Edit Top 200 Rows.
Right click on a table >>Edit Top 200 Rows



You can change Edit Top 200 Rows by following next steps:
Tools >> Options >> SQL Server Object Explorer >> Commands

First notice about SQL Server 2008 Management Studio

When I was started using SQL Server 2008 Management Studio, the first things I noticed are Select Top 1000 Rows and Edit Top 200 Rows replaced by Open Table in SQL Server 2005 Management Studio

9 Aug 2009

Convert ByteArray To Image

Image Table
CREATE TABLE [dbo].[Image_Table]
(
[Img_ID] [bigint] IDENTITY(1,1) NOT NULL,
[Image_Name] [image] NULL,
)


How To Convert Byte Array To Image
When you want to take image from database.It must change byte array to image to show it.
The next function convert byte array to image :

public Image byteArrayToImage(byte[] bArray)
{
MemoryStream ms = new MemoryStream(bArray);
Image Img = Image.FromStream(ms);
return Img;
}


How To Show Image
call the function:

pictureBox1.Image=byteArrayToImage((byte[])dr["Image_Name"]);

dr["Image_Name"]: is a data reader .it takes values from database.

Convert Image To ByteArray

Image Table
CREATE TABLE [dbo].[Image_Table]
(
[Img_ID] [bigint] IDENTITY(1,1) NOT NULL,
[Image_Name] [image] NULL,
)


How To Convert Image To Byte Array
When you want to save image in database.It must save it as byte array.
The next function convert image to byte array:

public byte[] imageToByteArray(System.Drawing.Image img)
{
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
return ms.ToArray();
}

17 Jun 2009

Problems in App_Code

There are many properties don't exist in App_Code pages.

Session in App_Code
when we use Session in App_Code following by error message
The name 'Session' doesn't exist in the current context
To fix this problem write next line in C#.net 2005
System.Web.HttpContext.Current.Session["SessionName"] = value;

Response in App_Code
when we use Response.Redirect in App_Code following by error message
The name 'Response' doesn't exist in the current context
To fix this problem write next line in C#.net 2005
System.Web.HttpContext.Current.Response.Redirect("Page.aspx");

11 Jun 2009

How can take backup from table...

How can take backup from table to another table in the same database?
We can use SELECT INTO to take backup.

We can select:
1.One column or more
select column1
into NewTable
from OldTable



2.All columns

select *
into NewTable
from OldTable


Also we can use where
select *
into NewTable
from OldTable
where column1='Haia'

10 Jun 2009

.net code converter (C# - VB.NET)

I found site that it easy way to convert code, just paste code then it will automatically convert:

1.Convert C# to VB.NET
csharp-to-vb

2.Convert VB.NET to C#
vb-to-csharp

4 Jun 2009

Computer until sleep

I was looking for sms then i found these cute pictures. Are they reflected lazy or serious people at work?