Dim cmd As New SqlCommand("getlast", conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@last", "last name"))
Dim adp As New SqlDataAdapter() adp.SelectCommand = cmd
Dim ds As New DataSet adp.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
Friday, September 28, 2007
Thursday, September 27, 2007
Most updated code.......
Imports CrystalDecisions.CrystalReports
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
dim UID as string
dim UPwd as string
dim SQLSrvName as string
dim Databasename as string
UID= "sa"
UPWD= " " 'in double codes pass password
SQLSrvName= " " 'in double codes pass servername
Databasename= " " 'in double codes pass databasename
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument rptDocument.Load(strReportPath)
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo ConInfo.ConnectionInfo.UserID = UID
ConInfo.ConnectionInfo.Password = UPwd
ConInfo.ConnectionInfo.ServerName = SQLSrvName ConInfo.ConnectionInfo.DatabaseName = Databasename
For IntCounter = 0 To rptDocument.Database.Tables.Count - 1
rptDocument.Database.Tables(IntCounter).ApplyLogOnInfo(ConInfo)
Next
rptDocument.SetDataSource(DS.Tables(0))
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
dim UID as string
dim UPwd as string
dim SQLSrvName as string
dim Databasename as string
UID= "sa"
UPWD= " " 'in double codes pass password
SQLSrvName= " " 'in double codes pass servername
Databasename= " " 'in double codes pass databasename
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument rptDocument.Load(strReportPath)
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo ConInfo.ConnectionInfo.UserID = UID
ConInfo.ConnectionInfo.Password = UPwd
ConInfo.ConnectionInfo.ServerName = SQLSrvName ConInfo.ConnectionInfo.DatabaseName = Databasename
For IntCounter = 0 To rptDocument.Database.Tables.Count - 1
rptDocument.Database.Tables(IntCounter).ApplyLogOnInfo(ConInfo)
Next
rptDocument.SetDataSource(DS.Tables(0))
Updated code for crystal report problem......
Imports CrystalDecisions.CrystalReports
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
'Assign the datasource and set the properties for Report viewer
Dim rptDocument As New
CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDocument.Load(strReportPath)
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo
ConInfo.ConnectionInfo.UserID = UID
ConInfo.ConnectionInfo.Password = UPwd
ConInfo.ConnectionInfo.ServerName = SQLSrvName
ConInfo.ConnectionInfo.DatabaseName = Databasename
For IntCounter = 0 To rptDocument.Database.Tables.Count - 1
rptDocument.Database.Tables(IntCounter).ApplyLogOnInfo(ConInfo)
Next
rptDocument.SetDataSource(DS.Tables(0))
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
'Assign the datasource and set the properties for Report viewer
Dim rptDocument As New
CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDocument.Load(strReportPath)
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo
ConInfo.ConnectionInfo.UserID = UID
ConInfo.ConnectionInfo.Password = UPwd
ConInfo.ConnectionInfo.ServerName = SQLSrvName
ConInfo.ConnectionInfo.DatabaseName = Databasename
For IntCounter = 0 To rptDocument.Database.Tables.Count - 1
rptDocument.Database.Tables(IntCounter).ApplyLogOnInfo(ConInfo)
Next
rptDocument.SetDataSource(DS.Tables(0))
Hope it will solve sumit sir's problem.........
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo
ConInfo.ConnectionInfo.UserID = UID
ConInfo.ConnectionInfo.Password = UPwd
ConInfo.ConnectionInfo.ServerName = SQLSrvName
ConInfo.ConnectionInfo.DatabaseName = Databasename
For IntCounter = 0 To rptDocument.Database.Tables.Count - 1
rptDocument.Database.Tables(IntCounter).ApplyLogOnInfo(ConInfo)
Next
in the above code declare uid,upwd,sqlsrvname,databasename as global
variables and then pass the values.
ConInfo.ConnectionInfo.UserID = UID
ConInfo.ConnectionInfo.Password = UPwd
ConInfo.ConnectionInfo.ServerName = SQLSrvName
ConInfo.ConnectionInfo.DatabaseName = Databasename
For IntCounter = 0 To rptDocument.Database.Tables.Count - 1
rptDocument.Database.Tables(IntCounter).ApplyLogOnInfo(ConInfo)
Next
in the above code declare uid,upwd,sqlsrvname,databasename as global
variables and then pass the values.
Thursday, September 13, 2007
To convert number into words
Function CurrencyToWord(ByVal MyNumber)Dim TempDim Rupees, Paisa As StringDim DecimalPlace, iCountDim Hundreds, Words As StringReDim Place(9) As StringPlace(0) = " Thousand "Place(2) = " Lakh "Place(4) = " Crore "Place(6) = " Arab "Place(8) = " Kharab "On Error Resume NextMyNumber = Trim(Str(MyNumber))Hundreds = ConvertHundreds(Right(MyNumber, 3))
If Len(MyNumber) >= 3 ThenMyNumber = Left(MyNumber, Len(MyNumber) - 3)
iCount = 0Do While MyNumber <> ""
Temp = Right(MyNumber, 2)If Len(MyNumber) = 1 ThenWords = ConvertDigit(Temp) & Place(iCount) & WordsMyNumber = Left(MyNumber, Len(MyNumber) - 1)
ElseWords = ConvertTens(Temp) & Place(iCount) & WordsMyNumber = Left(MyNumber, Len(MyNumber) - 2)End IfiCount = iCount + 2Loop
End If
CurrencyToWord = "Rs. " & Words & Hundreds & Paisa & " Only"
End FunctionPrivate Function ConvertHundreds(ByVal MyNumber)Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
If Left(MyNumber, 1) <> "0" ThenResult = ConvertDigit(Left(MyNumber, 1)) & " Hundred "End If
If Mid(MyNumber, 2, 1) <> "0" ThenResult = Result & ConvertTens(Mid(MyNumber, 2))Else
Result = Result & ConvertDigit(Mid(MyNumber, 3))End If
ConvertHundreds = Trim(Result)End Function
Private Function ConvertTens(ByVal MyTens)Dim Result As StringIf Val(Left(MyTens, 1)) = 1 ThenSelect Case Val(MyTens)Case 10: Result = "Ten"Case 11: Result = "Eleven"Case 12: Result = "Twelve"Case 13: Result = "Thirteen"Case 14: Result = "Fourteen"Case 15: Result = "Fifteen"Case 16: Result = "Sixteen"Case 17: Result = "Seventeen"Case 18: Result = "Eighteen"Case 19: Result = "Nineteen"Case ElseEnd SelectElse
Select Case Val(Left(MyTens, 1))Case 2: Result = "Twenty "Case 3: Result = "Thirty "Case 4: Result = "Forty "Case 5: Result = "Fifty "Case 6: Result = "Sixty "Case 7: Result = "Seventy "Case 8: Result = "Eighty "Case 9: Result = "Ninety "Case ElseEnd Select
Result = Result & ConvertDigit(Right(MyTens, 1))End If
ConvertTens = ResultEnd Function
Private Function ConvertDigit(ByVal MyDigit)Select Case Val(MyDigit)Case 1: ConvertDigit = "One"Case 2: ConvertDigit = "Two"Case 3: ConvertDigit = "Three"Case 4: ConvertDigit = "Four"Case 5: ConvertDigit = "Five"Case 6: ConvertDigit = "Six"Case 7: ConvertDigit = "Seven"Case 8: ConvertDigit = "Eight"Case 9: ConvertDigit = "Nine"Case Else: ConvertDigit = ""End SelectEnd Function
-------------------------------------------------------------------------------------
Steps to use this code:-
1. Open Excel
2. Go to Tools-->Macro-->visual basic editor
3. Go to Insert-->Module
4. Paste the above code.
5. Now come to excel, Go to Insert--> Functions
6. Select user defined function and then select CurrencyToWord()
7. Then ok
Dialogue box will appear it will ask for number enter the no. it will be converted
other way of using is
=CurrencyToWord(A1)
where 'A1' is the cellno.
If Len(MyNumber) >= 3 ThenMyNumber = Left(MyNumber, Len(MyNumber) - 3)
iCount = 0Do While MyNumber <> ""
Temp = Right(MyNumber, 2)If Len(MyNumber) = 1 ThenWords = ConvertDigit(Temp) & Place(iCount) & WordsMyNumber = Left(MyNumber, Len(MyNumber) - 1)
ElseWords = ConvertTens(Temp) & Place(iCount) & WordsMyNumber = Left(MyNumber, Len(MyNumber) - 2)End IfiCount = iCount + 2Loop
End If
CurrencyToWord = "Rs. " & Words & Hundreds & Paisa & " Only"
End FunctionPrivate Function ConvertHundreds(ByVal MyNumber)Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
If Left(MyNumber, 1) <> "0" ThenResult = ConvertDigit(Left(MyNumber, 1)) & " Hundred "End If
If Mid(MyNumber, 2, 1) <> "0" ThenResult = Result & ConvertTens(Mid(MyNumber, 2))Else
Result = Result & ConvertDigit(Mid(MyNumber, 3))End If
ConvertHundreds = Trim(Result)End Function
Private Function ConvertTens(ByVal MyTens)Dim Result As StringIf Val(Left(MyTens, 1)) = 1 ThenSelect Case Val(MyTens)Case 10: Result = "Ten"Case 11: Result = "Eleven"Case 12: Result = "Twelve"Case 13: Result = "Thirteen"Case 14: Result = "Fourteen"Case 15: Result = "Fifteen"Case 16: Result = "Sixteen"Case 17: Result = "Seventeen"Case 18: Result = "Eighteen"Case 19: Result = "Nineteen"Case ElseEnd SelectElse
Select Case Val(Left(MyTens, 1))Case 2: Result = "Twenty "Case 3: Result = "Thirty "Case 4: Result = "Forty "Case 5: Result = "Fifty "Case 6: Result = "Sixty "Case 7: Result = "Seventy "Case 8: Result = "Eighty "Case 9: Result = "Ninety "Case ElseEnd Select
Result = Result & ConvertDigit(Right(MyTens, 1))End If
ConvertTens = ResultEnd Function
Private Function ConvertDigit(ByVal MyDigit)Select Case Val(MyDigit)Case 1: ConvertDigit = "One"Case 2: ConvertDigit = "Two"Case 3: ConvertDigit = "Three"Case 4: ConvertDigit = "Four"Case 5: ConvertDigit = "Five"Case 6: ConvertDigit = "Six"Case 7: ConvertDigit = "Seven"Case 8: ConvertDigit = "Eight"Case 9: ConvertDigit = "Nine"Case Else: ConvertDigit = ""End SelectEnd Function
-------------------------------------------------------------------------------------
Steps to use this code:-
1. Open Excel
2. Go to Tools-->Macro-->visual basic editor
3. Go to Insert-->Module
4. Paste the above code.
5. Now come to excel, Go to Insert--> Functions
6. Select user defined function and then select CurrencyToWord()
7. Then ok
Dialogue box will appear it will ask for number enter the no. it will be converted
other way of using is
=CurrencyToWord(A1)
where 'A1' is the cellno.
Wednesday, September 12, 2007
Time Management is the real sense of Management
If i can Manage time , i am eligible to be called as a Manager
If i can't Manage time i dont have right to be called as Manager
If i can't Manage time i dont have right to be called as Manager
Subscribe to:
Comments (Atom)