Thursday, 30 May 2013

Insert excel data into MySql Table






1. First save the data in excel file in the .csv format.
2. For example execute a select query that returns more than 100 rows. And there is export option in result panel. Using that export as CSV file format.

From that file execute the below line to insert.
 
 LOAD DATA LOCAL INFILE 'C:\\temp\\dlyhdr.csv' INTO TABLE tt.dailystockheader
 FIELDS TERMINATED BY '\t'
 ENCLOSED BY '' LINES TERMINATED BY '\n' ;
 

Then select that table whether data has inserted or not.

Saturday, 18 May 2013

Fail to access iis metabase


You need to install the .net framework on you system

Open visual studio command prompt and type this command

aspnet_regiis -ga <UserName>
   example aspnet_regiis -ga \aspnet
if this doesn'twork than use this command

aspnet_regiis -i
 
alternatively you can copy and paste this command into windows command prompt

%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
 
this will fix your problem

Monday, 6 May 2013

how to determine 32 bit or 64 bit in vb6 or Visual Basic 6

Private Function Registry_Read(Key_Path, Key_Name) As Variant
      On Error Resume Next
       Dim Registry As Object
       Set Registry = CreateObject("WScript.Shell")
       Registry_Read = Registry.RegRead(Key_Path & Key_Name)
   End Function

' This  function read the value from registry editor

Private Sub Test()
    'Type-1
     MsgBox Registry_Read("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows  \CurrentVersion\", "ProgramFilesDir (x86)")
    'if 64 bit it will return the path name
    'if 32bit  , it will return empty string
    'from this we can identify 32 bit or 64 bit.

   
   
    'Type-2
           Dim sak As String
     sak = Registry_Read("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\", "Identifier")
     If InStr(1, sak , "64") Then
        MsgBox "Its 64 bit version !", vbInformation, "BASE"
       ' Write code as you want
     ElseIf InStr(1,sak , "x86") Then
        MsgBox "Its 32 bit version !", vbInformation, "BASE"
             ' Write code as you want
     End If
End Sub


Call the Test function. For example call the test function in Form Load event! with your own risk
I was collected this information in webpages!

Change the Default file location for SQL BackUp

Find the Key in regedit.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.SQLEXPRESSR2\MSSQLServer.

On Right side , Find the BackupDirectory string value. Edit the value as you want.

Try it own risk!.

Wednesday, 3 April 2013

shrink database in sql server 2008

Step1:
ALTER DATABASE BASE SET RECOVERY SIMPLE
 --Execute this line.
Step2:
-- Find the log file of data base.
SELECT name
FROM sys.database_files
WHERE type_desc = 'LOG'


Step3:
DBCC SHRINKFILE ('FINANCE_log', 1000)

OR
 Go to object browser-> then select database and make right click->Select TASK->SHRINK->Files
shrink window will open.
Choose File Type as LOG from dropdown control. Then click OK

DO it your OWN RISK.


VB6 and Crystal Reports 8.5

1. We can display the column value in crystal reports 8.5 through SP. Suppose the column is in varchar type and size of 1000.  That column will not display in formula field to apply formula.

2. In VB application we can use Rich text box control. In this control user can type the enter key to break the line. When we display the content of rich text box value in crystal report the line will break as per enter key value. In this case we can use Replace string formula (which available in crystal report formula section) .
Find string is chr(10),chr(13)  these are enter key value and replace with "" (space).


Tuesday, 5 March 2013

Open Excel File in VB6

Private Sub Command1_Click()

On Error GoTo ErrHandler
    Dim xlApp As Object
    Dim xlWB As Object
    
    Set xlApp = CreateObject("Excel.Application")
    xlApp.Visible = True
    
    Set xlWB = xlApp.Workbooks.Open("c:\Counselor.xls")
    Exit Sub
    
ErrHandler:
    MsgBox "There is a problem opening that workbook!", vbCritical, "Error!"
  End Sub 

http://www.mrexcel.com/forum/general-excel-discussion-other-questions/261062-simple-vb6-code-open-excel-file.html