|
|
|
|
|
Dicas
|
|
Visual Basic (Crystal Reports)
|
|
|
Título da Dica: Inicia crystal para qualquer banco
|
|
|
|
Postada em 27/6/2007 por Jailton Sampaio
jailton_sampaio@hotmail.com
Public Sub IniciaCrystal() Dim lStrPosIni As Integer Dim lStrPosfim As Integer gBlnAbriuRpt = True Select Case gDatDatabase Case eOracle lStrPosIni = InStr(1, gConnSiem, "Data Source=", vbTextCompare) gStrServer = Mid(gConnSiem, lStrPosIni + Len("Data Source="), Len(gConnSiem)) lStrPosIni = InStr(1, gConnSiem, "User ID=", vbTextCompare) lStrPosfim = InStr(1, gConnSiem, ";Data Source=", vbTextCompare) gStrUsuario = Mid(gConnSiem, lStrPosIni + Len("User ID="), lStrPosfim - (lStrPosIni + Len("User ID="))) lStrPosIni = InStr(1, gConnSiem, "Password=", vbTextCompare) lStrPosfim = InStr(1, gConnSiem, ";User ID=", vbTextCompare) gStrSenha = Mid(gConnSiem, lStrPosIni + Len("Password="), lStrPosfim - (lStrPosIni + Len("Password="))) Case eSQL lStrPosIni = InStr(1, gConnSiem, "Data Source=", vbTextCompare) lStrPosfim = InStr(1, gConnSiem, ";Use Procedure for Prepare=", vbTextCompare) gStrServer = Mid(gConnSiem, lStrPosIni + Len("Data Source="), lStrPosfim - (lStrPosIni + Len("Data Source="))) lStrPosIni = InStr(1, gConnSiem, "User ID=", vbTextCompare) lStrPosfim = InStr(1, gConnSiem, ";Data Source=", vbTextCompare) gStrUsuario = Mid(gConnSiem, lStrPosIni + Len("User ID="), lStrPosfim - (lStrPosIni + Len("User ID="))) lStrPosIni = InStr(1, gConnSiem, "Password=", vbTextCompare) lStrPosfim = InStr(1, gConnSiem, ";Persist Security Info=", vbTextCompare) gStrSenha = Mid(gConnSiem, lStrPosIni + Len("Password="), lStrPosfim - (lStrPosIni + Len("Password="))) 'df:030707 - Para resolver o problema que o crystal estava deixando o ' nome do banco fixo quando era SQL gStrUsuario = Replace(gStrUsuario, "Initial Catalog", "Database") Case eAccess lStrPosIni = InStr(1, gConnSiem, "Data Source=", vbTextCompare) lStrPosfim = InStr(1, gConnSiem, ";Mode=", vbTextCompare) gStrServer = Mid(gConnSiem, lStrPosIni + Len("Data Source="), lStrPosfim - (lStrPosIni + Len("Data Source="))) lStrPosIni = InStr(1, gConnSiem, "User ID=", vbTextCompare) lStrPosfim = InStr(1, gConnSiem, ";Data Source=", vbTextCompare) gStrUsuario = Mid(gConnSiem, lStrPosIni + Len("User ID="), lStrPosfim - (lStrPosIni + Len("User ID="))) lStrPosIni = InStr(1, gConnSiem, "Password=", vbTextCompare) lStrPosfim = InStr(lStrPosIni, gConnSiem, ";", vbTextCompare) gStrSenha = Mid(gConnSiem, lStrPosIni + Len("Password="""), lStrPosfim - (lStrPosIni + Len("Password="""))) End Select End Sub
|
|
|
|
|