Hi, I am passing sql query as a parameter to the function. When i try to execute the code, it is throwing me error "ExecuteReader: CommandText property has not been initialized"
It works fine when i put SQl query in the code and execute. The problem is when I am passing that query as parameter using excel data connector. Below is the code that i have used. Please let me know where might be the issue.
Public Shared Sub TestConnection(query as String)
Dim digitalTracksDT As System.Data.DataTable
Dim conn As New OdbcConnection("DSN=Database_Name")
conn.Open()
System.Console.WriteLine("Database Connection opened ")
Dim digitalTrackGet As New OdbcCommand(query, conn)
Dim adp3 As New OdbcDataAdapter(digitalTrackGet)
adp3.Fill(digitalTracksDT)
System.Console.WriteLine("Data Table filled successfully")
conn.Close()
End Sub
"CommandText property has not been initialized" error
-
- Posts: 31
- Joined: Mon Feb 22, 2016 7:21 pm
Re: "CommandText property has not been initialized" error
Hi,
Is this problem somehow related to another your post?...
http://www.ranorex.com/forum/pass-param ... t9236.html
Have you debugged the code? Is the 'query' variable actually filled with something?
Is this problem somehow related to another your post?...
http://www.ranorex.com/forum/pass-param ... t9236.html
Have you debugged the code? Is the 'query' variable actually filled with something?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Posts: 31
- Joined: Mon Feb 22, 2016 7:21 pm
Re: "CommandText property has not been initialized" error
Hi,
I think this another issue when code is executed from recorder. I am getting this error when I am executing the code module from recorder even thought the parameter values are defined in the code itself.
I think this another issue when code is executed from recorder. I am getting this error when I am executing the code module from recorder even thought the parameter values are defined in the code itself.
- RobinHood42
- Posts: 324
- Joined: Fri Jan 09, 2015 3:24 pm
Re: "CommandText property has not been initialized" error
Hi,
take a look at the following thread:
https://social.msdn.microsoft.com/Forum ... aproviders
I aggree totally with Pavel, you should use the debugger in order to analyze your code.
Cheers,
Robin
take a look at the following thread:
https://social.msdn.microsoft.com/Forum ... aproviders
I aggree totally with Pavel, you should use the debugger in order to analyze your code.
Cheers,
Robin