ODBC datasource
connecting to SQL Server. Without DiscardSavedData
this works, but it displays old data. With DiscardSavedData
, I get the error message:-------------------BEST ANSWER-------------------------------
Dim buffer1 As String * 255
Dim buffer2 As String * 255
Dim buffer3 As String * 255
Dim buffer4 As String * 255
Dim w, x, y, z, abc As Long
w = GetPrivateProfileString("KONEKSI SERVER", "server", "", buffer1, Len(buffer1), App.Path + "\cetak.ini")
x = GetPrivateProfileString("PORT SERVER", "port", "(error)", buffer2, 255, App.Path + "\cetak.ini")
y = GetPrivateProfileString("USER LOGIN", "login", "(error)", buffer3, 255, App.Path + "\cetak.ini")
z = GetPrivateProfileString("USER PASSWORD", "password", "(error)", buffer4, 255, App.Path + "\cetak.ini")
abc = Len("cetak_" & Menu_MDIForm.StatusBar1(0).Panels(4).Text)
abc = abc - 0
db_name = Left("cetak_" & Menu_MDIForm.StatusBar1(0).Panels(4).Text, abc)
dbb_name_cetak = db_name
db_server = Left(buffer1, w) 'localhost
db_port = Left(buffer2, x) '3306
db_user = Left(buffer3, y) 'client
db_pass = Left(buffer4, z) 'talenta
CrystalReport1.WindowMinButton = False
CrystalReport1.WindowState = crptMaximized
CrystalReport1.DiscardSavedData = True
CrystalReport1.Connect = "Data Source=" & db_server & ";UID=" & db_user & ";PWD=" & db_pass & ";DSQ=Dat " & db_name & ";"
CrystalReport1.ReportFileName = App.Path & "\report\cetak_simpanan.rpt"
CrystalReport1.Action = 1