im using vb.net, oracle and crystal report , i have two reports one have connection "database Expert --- project data --- DataSet1, working fine no issue , another one have connection "database Expert --- My Connection --- Sureguide" this one giving me this msg Failed to load database information ,.... what should i do to resolve this problem
the one is working
the reports which not working
If Not sgcnn.State = ConnectionState.Open Then
sgcnn.Open()
End If
Dim rpt As New RptAccountsChart() 'The report created
'Dim rpt As New RptChartOfAccountsrpt 'The report created.
Try
Dim comd As New OracleCommand("select * from ACCOUNT_JV order by ACCOUNT_CODE,HEAD_CODE,JV_CODE ", sgcnn)
Dim da As New OracleDataAdapter(comd)
Dim dt As New DataTable()
da.Fill(dt)
rpt.SetDataSource(dt)
CRVChartOfAccounts.ReportSource = rpt
rpt.SetDatabaseLogon("sureguide_admin", "ajaz661")
rpt.Refresh()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Related
We are using Visual Studio 2015 & SAP crystal reports v13.
Step 1: I’m fetching the Query from the crystal report by using the GetCommandText() function.
Following the code is GetCommandText() function.
Dim boReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim boReportClientDocument As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument = boReportDocument.ReportClientDocument
Dim boReportClientDocument As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument = boReportDocument.ReportClientDocument
Dim SqlQuery As String = ""
boReportClientDocument.RowsetController.GetSQLStatement(ISCRGroupPath, SqlQuery)
Step 2: I’m trying to concatenate the where condition into the SQL query.
Step 3: Then the Query is Execute and assigned to a dataset.
Step 4: And Set the Dataset value into the CrystalReport.setdatasource.
If I am trying to use the Specific field in the Select query for binding the crystal report, I am getting the attached error.
error image
In the same condition if I am trying to change the Specific filed into Select * From the crystal report is loading correctly. But the “where” condition is not getting considered. The crystal report is loading all the data.
so here is how to update the query into the crystal report. The query is supporting in VB6 & not supporting in vb.net
Following the code is VB.net
Dim ReportDoc As New ReportDocument
Dim ConnectionString = "Data Source=test;Initial Catalog=testDB;User ID=sa;Password=123;"
ReportDoc.Load("~\CrystalReportTesting\CrystalReport1")
Dim con As SqlConnection = New SqlConnection(ConnectionString)
Dim cmd As SqlCommand = New SqlCommand(SqlQuery, con)
Dim adapter As New SqlDataAdapter(cmd)
Dim dtset As New DataSet
adapter.Fill(dtset, "Dataset1")
ReportDoc.SetDataSource(dtset.Tables.Item(0))
CrystalReportViewer1.ReportSource = ReportDoc
CrystalReportViewer1.Refresh()
Following the Code is VB6
fReport.Report.SQLQueryString = fReport.Report.SQLQueryString & _
" where ""Invoice"".""Ref"" in (" & 1,2,3 & ") " & sqlOrderby
I´m trying to develop a system that reproduces a quiz game. Basically it´s developed with vb (vs 2017) and microsoft access database.
In certain point after the player choose the wrong answer, the system compiles the results with name, amount of righ questions and maximum score.
Aftewards it should record in the database the results., but, it doensnt make it.
My code follow bellow:
Sub RegistraJogo()
Try
Dim Conn As New OleDbConnection
Conn.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source=DbDesafioQuiz.accdb"
Conn.Open()
Dim cmd = Conn.CreateCommand
cmd.CommandText = "INSERT INTO TbRecordes (Nome, Data, Pontos, Acertadas) VALUES (#Jogador, #Datas, #Pts, #Corretas)"
cmd.Parameters.AddWithValue("#Jogador", LbJogador.Text) 'nome do jogador
cmd.Parameters.AddWithValue("#Datas", CStr(Now())) 'data do jogo
cmd.Parameters.AddWithValue("#Pts", CStr(PontosTotais * QtdRespondidas)) 'variáveis com valores de pontos e qtd de questões resp
cmd.Parameters.AddWithValue("#Corretas", QtdRespondidas) 'qtd de questões respondidas
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
End Try
receivedData = 0
End Sub
Someone could help me, indicanting what i´m doing wrong? Thanks in advance.
I´ve changed the connection string, putting the complete address of database, like:
"c:\temp\dbdesafioquiz.accdb"
Currently I'm develop a system using VB.NET. I have the following query for UPDATE. This query is work when I run in SQL Developer
UPDATE CCS2_TBL_INSPECTION_STANDARD SET CCSEQREVITEM = :CCSEQREVITEM,
CCSREVEFFECTIVEDATE = TO_DATE(:CCSREVEFFECTIVEDATE,'DD/MM/YYYY') WHERE
CCSEQID = :CCSEQID
But when I try applied this query in VB.net, its not work. Actually the flow for this update function is work but when I update the data, it is not working. For example, I want update name from 'Ali' to 'Abu', when I click the update button, there popup windows says that "Update success" but the name is not change to 'Abu', it still 'Ali'. There no error when I execute. Anyone know? Below VB.net code:
Protected Sub editInspectionRev(eqid As String)
Dim xSQL As New System.Text.StringBuilder
xSQL.AppendLine("UPDATE CCS2_TBL_INSPECTION_STANDARD")
xSQL.AppendLine("SET")
xSQL.AppendLine("CCSEQREVITEM = :CCSEQREVITEM, CCSREVEFFECTIVEDATE = TO_DATE(:CCSREVEFFECTIVEDATE,'DD/MM/YYYY')")
xSQL.AppendLine("WHERE CCSEQID = :CCSEQID")
Using cn As New OracleConnection(ConString)
cn.Open()
Dim cmd As New OracleCommand(xSQL.ToString, cn)
cmd.Connection = cn
cmd.Parameters.Add(":CCSEQREVITEM", txtRevContent.Text)
cmd.Parameters.Add(":CCSREVEFFECTIVEDATE", txtRevEffDate.Text)
cmd.Parameters.Add(":CCSEQID", eqid)
cmd.ExecuteNonQuery()
cn.Close()
End Using
success3.Visible = True
DisplayRevisionDetails()
End Sub
The problem is that you have executed the transaction but failed to COMMIT it. There is an example of the correct method here, which I will reproduce in part below for posterity
Using connection As New OracleConnection(connectionString)
connection.Open()
Dim command As OracleCommand = connection.CreateCommand()
Dim transaction As OracleTransaction
' Start a local transaction
transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)
' Assign transaction object for a pending local transaction
command.Transaction = transaction
...
command.ExecuteNonQuery()
transaction.Commit()
Observe that we have begun the transaction, and then committed it after executing.
Good day sirs. I'm trying to retrieve a photo from my access database then load it in a PictureBox but I have this kind of problem which I can't resolve.
I have seen questions similar to mine but I can't understand the solutions given by others as I'm just a newbie. Will someone please help me correct my codes for retrieving image file from access database. Thanks
I'm using access database and Visual Basic 2010.
Here's the code:
Dim arrImage() As Byte
Dim myMS As New IO.MemoryStream
Dim da As New OleDb.OleDbDataAdapter("SELECT *
FROM tblEmp
WHERE EmployeeID= '"
& Me.txtID.Text
& "'", con)
Dim dt As New DataTable
da.Fill(dt)
If dt.Rows.Count > 0 Then
If Not IsDBNull(dt.Rows(0).Item("Picture")) Then
arrImage = dt.Rows(0).Item("Picture")
For Each ar As Byte In arrImage
myMS.WriteByte(ar)
Next
'
inFrm.PictureBox1.Image = Image.FromStream(myMS)
End If
End If
I'm getting a "Parameter is not valid" error from the line
inFrm.PictureBox1.Image = Image.FromStream(myMS)
try replacing the line of code with this
inFrm.PictureBox1.PictureData = myMS.Read
I'm having difficulty using the Update function on a RecordSet object while using the DBISAM 4 ODBC driver. Here is what my code looks like.
dtmNewDate = DateSerial(1997, 2, 3)
MsgBox(dtmNewDate)
'Create connection object & connection string
Set AConnection = CreateObject("ADODB.Connection")
strConnection = "Driver={DBISAM 4 ODBC Driver}; CatalogName=S:\RAPID\Z998\2008; ReadOnly=False"
Aconnection.Mode = adModeReadWrite
AConnection.Open strConnection
'create SQL statement to be run in order to populate the recordset
strSQLEmployeeBDate = "SELECT * FROM Z998EMPL WHERE state = 'NY'"
'Create Recordset object
Set rsRecSet = CreateObject("ADODB.Recordset")
rsRecSet.LockType = 2
rsRecSet.Open strSQLEmployeeBDate, AConnection
While Not rsRecSet.EOF
rsRecSet.Fields("BIRTHDATE").value = dtmNewDate
rsRecSet.Update
rsRecSet.MoveNext
Wend
When I try to execute this code I receive the following error:
"DBISAM Engine Error #11949 SQL Parsing error- Expected ( but instead found = in UPDATE SQL statement at line 1, column 336"
I can't figure out what is causing this error. Does anyone have any ideas as to what is causing it?
DBISAM error messages Check the field name.