Friday, February 7, 2014

Microsoft SQL Server, Error: 18456

Cannot connect to User_Name-PC
Login failed for User_Name-PC (Microsoft SQL Server, Error: 18456) 













This is one annoying error message you get when trying to connect to an instance of SQL Server BUT, not to worry, COS, problem's solved.
All you have to do is "turn user account control off". Follow the below steps to turn off user account control

Goto Start ~> Control Panel ~> User Account ~> Turn user account control on or off ~> Then, uncheck the 'Use User Account control (UAC) to help protect your computer' check box ~> Click OK, you would get the below message asking for sytem restart, click restart now. thats all. job's DONE.

Thursday, February 6, 2014

Hoe to Create/Establish a VBasic--SQL Server Database Connection



Shown in the above form is a first name, last name and age text boxes named txtFName, txtLName and txtAge respectively. lastly, is the update button named BtnUpdate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Source Code ~> Vbasic 2010 vs Sql Server 2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Imports System.Data
Imports System.Data.SqlClient

Public Class frm_main  ' Class Begins Here

    ' Declare a new Sql_client_connection = SqlConn
    ' Sql_Command = SqlComm AND
    ' Sql_Connection_String
    Dim SqlConn As New SqlClient.SqlConnection
    Dim SqlComm As New SqlCommand
    ' Data Source = Server Name; Initial Catalog = DataBase Name
    Dim SqlConnString = "Data Source=DOUBRA-PC;Initial Catalog= clems;Integrated Security=True "

    Private Sub frm_main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        SqlConn.ConnectionString = SqlConnString
        SqlConn.Open()

    End Sub

    Private Sub BtnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnUpdate.Click

        SqlComm.CommandText = "Insert into Employee values(' " & txtFName.Text & " ', ' "          & txtLName.Text & " ', ' " & txtAge.Text & " ')"

        SqlComm.CommandType = CommandType.Text
        SqlComm.Connection = SqlConn
        SqlComm.ExecuteNonQuery()

    End Sub
End Class    ' Class Ends Here

Source code screen shot
~~~~~~~~~~~~~~~~










Data base screen shot
~~~~~~~~~~~~


















Still don't get it, watch the below video

Tuesday, February 4, 2014

Hoe to Create/Establish a VBasic--MS Access Database Connection

STEPS
After Designing your form and naming your controls, follow the below steps:

**Double click on any area on your form to display the code window
Outside your class scope, import both system.Data and system.Data.oledb
~~~~~~~~~~~~~~~~~~~                                                                                  
Imports System.Data                                                                         
Imports System.Data.OleDb 
~~~~~~~~~~~~~~~~~~~                                                                                      
**Now, inside your class but outside any method/function, declare a new connection, command and connection string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~                                                            
Dim Conn As New OleDbConnection     
Dim Conn_command As New OleDbCommand                                           
Dim Conn_String = "   ' your connection string "                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~

**Next, under your forms load event, set and open the connection             ~~~~~~~~~~~~~~~~~~~~~~                                                                          
Conn.ConnectionString = Conn_String
Conn.Open()
~~~~~~~~~~~~~~~~~~~~~~                                                                                                       
**Lastly, set your command text, command type, connection AND execute your sql statement                                                                           
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Conn_command.CommandText = " Sql statement "
Conn_command.CommandType = CommandType.Text
Conn_command.Connection = Conn
Conn_command.ExecuteNonQuery()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Still don't get it, see example below
------------------------------
Windows form ~> frm1.vb
------------------------------














First name text box is named txtFirstName
Last name text box is named txtLastName
Address text box is named txtAddress
Phone text box is named txtPhone
Update button is named BtnUpdate

Source Code ~> Designed using vb 2010
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' import statements ~> Outside the class scope 
Imports System.Data
Imports System.Data.OleDb
' class begins
Public Class frm_main   
    
    ' NOW Inside the class BUT outside any method scope                                                                  Creat a new Oledb Connection = Access Dbase connection
    Dim Conn As New OleDbConnection

    ' Creat a new Oledb Command
    Dim Conn_command As New OleDbCommand

    'Connection String = The database connection string
    Dim Conn_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data               Source=C:\DBaseFiles\Employee.mdb"
    Private Sub frm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' Set the connection String
        Conn.ConnectionString = Conn_String

        'Open the connection 
        Conn.Open()
    End Sub

     ' Click event
    Private Sub BtnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnUpdate.Click

        Dim Query As String
        Query = "Insert into Emp_PersonalDetails values (' " & txtFirstName.Text & " ', ' " & txtLastName.Text & " ', ' " & txtAddress.Text & " ', ' " & txtPhone.Text & " ')"
        Conn_command.CommandText = Query
        'Set the command type
        Conn_command.CommandType = CommandType.Text
        'Set the connection
        Conn_command.Connection = Conn
        'Execute Query
        Conn_command.ExecuteNonQuery()

         ' Display message     
         Dim msg As String
        msg = MessageBox.Show("Record Updated Succesfully", "Employee DBase")

    End Sub
End Class

Source code screen shot
~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Below is the database view after a record is added/updated:







Still don't get it, watch the below video 

Who is a Software Developer?

A software developer is a person who is responsible to make specialized computer software for a client, or for himself OR herself. 
There are three kinds of software developers:
1. Computer Programmers
2. Software Developers, User Applications
3. Software Developers, Systems
As a software developer in an organization, your job will involve some or more of the following:
• Designing software
• Programming
• Installation
• Configuration
• Customization
• Specification
• Requirements analysis
• Development and refinement of simulations or prototypes
• Feasibility and cost–benefit analysis
• Testing
• Maintenance
In other words, in this technical world, the work of a software developer is extremely important. It also carries good financial benefits.