Wednesday 20 November 2013

How to Fetch Data from SQl Server to Excel 2007 Without Code

How to Fetch Data from SQl Server  to Excel 2007 Without Code
Step1 : First You have to make a DataBase and Table in Sql Server.
Step2: Open Excel where you want to Fetch the data go to Data tab from menu bar in External Data tab
select  from Sql Server



Step3:  give server name with comma  (,)  1433 it is the sql server port no.

Step 4: After next Select Data Base and table.

Step 5: Then Next Then select the starting Cell then ok

Click Ok …..:)

Monday 18 November 2013

Create a Setup in Visual Studio

Step to make Setup of Project in Visual Studio.
1.
From file menu  new  Project  select  Setup and Deployemnet









Step2 :
Right click on setup  view  File 


Step 3
Right click Application Folder   Add   project Output




Step 4  in Project Output you can add file or document file xml file


Click Ok


Merely add one or more of the files that is vital for your application by clicking on File…. Now that you have you files in place. Solution Explore /Setup /Detected Depences /primary Output


Step 5
Now to Create Shortcut  
Right Click on primary Out  Select first Option



















To  Assign icon Select Shortcut which you create   right Click  Property Window
Select icon option  browse icon  select .ico  file from you machine if you don’t have ico file then first create that file   drag and drop Shortcut into users’s Dekstop Folder



The next item you find of immense importance is the User Interface Editor. Inside of this editor you may eliminate or include dialogs that are needed for this install project.


Right Click Setup view user interface right click Add diolog






Then Select customer information ok





























The following screenshot is the default User Interface that is created when I initially created this setup project The only variation is that I have added a Customer Information dialog.








Prerequisites Installation in Windows Installer
Most applications have prerequisites: Components such as the .NET Framework runtime must be available on a target computer in order for the application to run. The deployment tools in Visual Studio include the capability to automatically detect the existence of components during installation and install a predetermined set of prerequisites — a process known as bootstrapping.




To choose which prerequisites to install
  1. In Solution Explorer, select the deployment project and Right Click
  2. Click Properties.
  3. In the Property Pages dialog box, expand the Configuration Properties node, and then select the Build property page.
  4. Click the Prerequisites button.
  5. In the Prerequisites dialog box, make sure that the Create setup program to install prerequisite components box is checked.
  6. In the Choose which prerequisites to install list, check the prerequisites that you wish to install, and then click OK.
To specify the download location for prerequisites
  • In Solution Explorer, select the deployment project, right click.
  • Click Properties.
  • In the Property Pages dialog box, expand the Configuration Properties node, and then select the Build property page.
  • Click the Prerequisites button.

In the Prerequisites dialog box, choose a location:
    • If you want to deploy the installers for the prerequisites to a vendor, click Download prerequisites from the component vendor's web site.
    • If you want to deploy the installers for the prerequisites to the same location as your application installer, click Download prerequisites from the same location as my application.


    • If you want to deploy the installers for the prerequisites to a different location, click Download
  • Click OK to continue.



Out put File name   This will indicate where your setup or Exe file will build…..















Final :   Now Build the Setup

Friday 16 August 2013

Show All Forms In Project in vb.net

This code it will display all the forms in the project  just create a form and insert listbox and a button and in click event of button write this code

 Dim MyAssembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
        Dim type As Type() = MyAssembly.GetTypes()
        For Each myType In type
            If myType.BaseType.FullName = "System.Windows.Forms.Form" Then
                ListBox1.Items.Add(myType.Name)
            End If
        Next

Tuesday 23 July 2013

Upload image in picturebox using vb.net


    Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        Try
            Dim file As New OpenFileDialog()
            file.Filter = "Image FilesImage Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp"  'you can 'ad more extension
            If (file.ShowDialog() = DialogResult.OK) Then
                Dim filename As String = System.IO.Path.GetFullPath(file.FileName)
                picBox.Image = New Bitmap(file.FileName)
                Me.picBox.SizeMode = PictureBoxSizeMode.StretchImage
            End If
        Catch ex As Exception
        End Try
    End Sub

Monday 8 April 2013

How to Import Data from Excel to sql server

'First of all create a table in Sql server. 
'where you keep imported data
 then go to excel which you want to import then developer tab / insert / module/.
in the developer tab / tools / references /select Microsoft Active library 2.7 /
then write you code.
here


Sub Rectangle1_Click()
'TRUSTED CONNECTION
    On Error GoTo errH
  
    Dim con As New ADODB.Connection         'declare variable data type
    Dim rs As New ADODB.Recordset
    Dim strPath As String
    Dim intImportRow As Integer
    Dim name, proj_name, pdf_source, pub, issue, Article, status As String
    Dim year, page  As Integer
    Dim rec_date As String
    Dim server, username, password, table, database As String
   
   With Sheets("Salt Lake and Metiabruz_ZONING")
  
   server = ".\SQLEXPRESS"       'server name
   table = "MstProject"              'my table in sqlserver
   database = "Aptara"              'my database name
  
    If con.State <> 1 Then
  
    con.Open "Provider=SQLOLEDB;Data Source=" & server & ";Initial Catalog=" & database & ";Integrated Security=SSPI;"   '(this is connection string)
                'con.Open
         
    End If
            'this is the TRUSTED connection string              ' zari
    Set rs.ActiveConnection = con
    intImportRow = 3  ' indciate row number, that means it will start selecting from the very first row
    Do Until .Cells(intImportRow, 1) = ""        'condition untill the row find blank
    name = .Cells(intImportRow, 1)                 'assign the value
    proj_name = .Cells(intImportRow, 2)
    pdf_source = .Cells(intImportRow, 3)
    year = .Cells(intImportRow, 4)
    rec_date = .Cells(intImportRow, 5)
    pub = .Cells(intImportRow, 6)
    issue = .Cells(intImportRow, 7)
    Article = .Cells(intImportRow, 8)
    page = .Cells(intImportRow, 9)
    status = .Cells(intImportRow, 13)
    con.Execute "insert into MstProject (Operataor_Name,Proj_Name,Pdf_Source,Yr,Rec_Date,Pub,Issue,Article_No,Page,Status) values ('" & name & "', '" & proj_name & "', '" & pdf_source & "','" & year & "','" & rec_date & "','" & pub & "','" & issue & "','" & Article & "','" & page & "','" & status & "')"     
    intImportRow = intImportRow + 1         ' increase the row
    Loop
    MsgBox "Done importing", vbInformation
          
    con.Close
    Set con = Nothing
  
    End With
    Exit Sub

errH:
    MsgBox Err.Description
End Sub





Followers