|
I'm trying to use parameterized queries in VB6. I am using the Oracle ODBC driver version 9.02.00.00. All of the Oracle documentation states that I should be using a colon (: ) to identify the parameter (i.e. :myparam). However, I've found documentation that says I should be using a question mark (?). My code currently works if I have one parameter in a query (i.e. Select name, id, blah from tablename where id=? ). But if I have two parameters (i.e Select name, id, blah from tablename where id=? and blah=?), I receive the following error message.
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done
Of course this message doesn't help me at all.
Originally, I was expecting to create queries like "Select name,id,blah from tablename where (id= :Id and blah= :Blah) and then Append parameters to the Command object that is executing the query, but that doesn't seem to work.
Any thoughts or ideas are much appreciated.
-- modified at 16:11 Thursday 25th May, 2006
|
|
|
|
|
Hello, does anyone know if this is a bug or if I’m doing it wrong. I’m basically I’m using two For loops to filter out items from one list if they already exits on another (for dual list control). But when I remove a item from the list and I decrement the variable it looks like it does not decrement in memory therefore the inner loop will always read 23 even though I decrement the variable Sourcecounter. SO if outer loop has 2 items and inner loop has 23 and a item matches then I decrement the initial length of the inner loop by SourceLenght - 1. But the variable Sourcecounter will always go to 23 not 22.
Here is the sample
Dim DestinationLenght As Integer = 2
Dim SourceLenght As Integer = 23
Dim Destinationcounter As Integer
For Destinationcounter = 0 To DestinationLenght
Dim Sourcecounter As Integer
For Sourcecounter = 0 To SourceLenght
If Me.lstSource.Items(Sourcecounter).Text.ToString = Me.lstDestination.Items(Destinationcounter).Text.ToString Then
Me.lstSource.Items.RemoveAt(Sourcecounter)
Sourcecounter = Sourcecounter - 1
SourceLenght = SourceLenght - 1
End If
Next
Next
Thanks
|
|
|
|
|
The expressions in the For statement is calculated once when the loop is started, not every iteration.
---
b { font-weight: normal; }
|
|
|
|
|
your concept will work if you use a while loop for the inner loop.
Sourcecounter = 0
Sourcelength = 23
While Sourcecounter < Sourcelength
Sourcecounter +=1
If <condition> then
<do removal>
Sourcecounter -= 1
Sourcelength -= 1
End If
End While
|
|
|
|
|
|
Hi,
I have been using MMC in VB. Im using OCX view instead of MMC listview.
If anybody knows how to align ocx picture box in MMC control, pls let me know.
Thanks in Advance.
Shiva
yemshivakumar@gmail.com
|
|
|
|
|
how to make a textbox that the user can enter only text no numbers! help me please!
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
Hope this helps: set the e.Handled flag to true in the KeyPress event if the value is in the range that you wnat to ignore.
Private Sub TextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt_user_name.KeyPress<br />
Select Case e.KeyChar<br />
Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"<br />
e.Handled = True<br />
End Select<br />
End Sub
|
|
|
|
|
Hiya
I was surfing the web looking for an answer to the same problem and found an extremely low priced suite of controls called ITTeamControls .Net. It includes TextBox that has an AllowedKeys property. You can set it to allow text only, numbers only or all. So there is no code involved.
The web page is http://www.itteam.net/itteamcontrols.html[^]
They have a number of low priced utilities for .Net developers. We have bought stuff off them.
Hope this helps
Rob
-- modified at 5:59 Friday 26th May, 2006
|
|
|
|
|
Hi , it is just pretty simple i had this problem before but i solved it with this
just copy & past & it will work if you don't understand the code i can explain it for you too
Public Function FiltreStringASCII(ByVal var As Integer) As Boolean<br />
<br />
If var = 8 Or var = 32 Or var > 64 AndAlso var < 91 Then<br />
Return True<br />
ElseIf var > 96 AndAlso var < 123 Then<br />
Return True<br />
Else<br />
Return False<br />
End If<br />
<br />
End Function<br />
Public Sub Check(ByVal b As Boolean, ByVal e As System.Windows.Forms.KeyPressEventArgs)<br />
If b = True Then<br />
e.Handled = False<br />
Else<br />
e.Handled = True<br />
End If<br />
End Sub
and now call this methods in the keypress event of the text you want to write just text in :
Private Sub Textbox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Matr_Rec.KeyPress<br />
Check(FiltreStringASCII(Asc(e.KeyChar)), e)<br />
End Sub
you can change the visibility of the methods over i just used Public cuz i call those methodes from an other class
try to be good if you can't be the best
-- modified at 8:07 Friday 26th May, 2006
|
|
|
|
|
hello all,
i want to create runtime odbc for sql server. because i have many database in my sql server..my problem is that
for example :
i create my crystal report user database payroll and i create manually odbc for payroll.my problem is that if i not work in different database then my report not show me record. this is why i want to create odbc for runtime. pls help
vipin paliwal
|
|
|
|
|
Ive got a button on a form and am trying to get the flashwindow api to
work with the form , however it seems i don't understand it! As i have never done an api call im not too surprised.!!
Declare Function FlashWindow Lib "user32" Alias "FlashWindow" (ByVal hwnd As Long, ByVal bInvert As Long) As Long<br />
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
End Sub<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
FlashWindow(1, True)'what are the arguments this call should use?
End Sub
no error when i click button, just nothing happens?
Any help will be appreciated.
|
|
|
|
|
MickYL wrote: Ive got a button on a form and am trying to get the flashwindow api to
work with the form , however it seems i don't understand it! As i have never done an api call im not too surprised.!!
Declare Function FlashWindow Lib "user32" Alias "FlashWindow" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
FlashWindow(1, True)'what are the arguments this call should use?
End Sub
I did see the same question asked by someone else. It could be one or two days back. Just doing a forum search could help.
I guess it should be
FlashWindow(Me.Handle, True) :~
Is it Me.Handle or Me.Hwnd I am not sure please check anyway the first one takes the handle of the window to be flashed. In your case it is this window hence Me .
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
I tried after recieving your advice which was similar to advice from others elsewhere, but now i get an error that Me.handle cannot be converted to long ??? me.handle nealy worked i guess. the other suggestion was a syntax error.thx
|
|
|
|
|
Actually that was me who posted it a few days ago and I dont think its going to get a reply ! Thanks for your suggestion. I will try it and see how things go!
thx....
|
|
|
|
|
Hi,
does anybody know, how to convert RSA public key into Base64 Encoded string.
Actually I'm creating Keypair and digital signature using RSA in VB.NET and verifying it into java. For that i need to store the the RSA public key into a file on the hard drive. Later Java class will fetch this public key and use it for verification.
But when i give the RSA public key into Xml format to Java class it is giving an error "Invalid Key Exception." Java class needs Base64 encoded string. So how to convert this xml key into Base64. It will be gr8 if anybody helps me in this issue.
thanks
|
|
|
|
|
How to preview Report without using crystal reports and Export it to any format like Pdf,xls etc.
ssadsadadgawkjawoidehqwohoiweheiwqhrewoihriwolhrwiehriwehfuiwhfiluwhwifhiwhfiwhfiwehfiwhrwhrwhuiw
|
|
|
|
|
That would depend on what kind of report you're using. If it's a Crystal Report file, then you need use crystal reports. If you haven't created the report yet, then I would look into a 3rd party add-in that will allow you to do that. If you only want to display it in one format like excel, then you can just create an Excel Application object and fill your sheets through it.
|
|
|
|
|
Hiya, Do you mean how to preview your crystal report classes? I had the same problem. I was browsing the net looking for an answer when I found a web site that offered a means to do just that. Below is the link
http://www.itteam.net/itteamreportviewer.html[^]
They offer a number of low cost .Net development utilities.
Hope this helps
Rob
-- modified at 13:12 Friday 26th May, 2006
|
|
|
|
|
I am trying to connect to a system in a network through WMI.
If i am not able to connect to a system through WMI then generally i get
"Access Denied" error. for which i know the solution.
But now i am getting "RPC server unavaliable"
Can someone tell me shat does it means and it's solution.
|
|
|
|
|
sounds like the rpc server isn't running on the machine you're attempting to connect to. Pull up the services on that machine and see if it's running.
|
|
|
|
|
We have checked the services and yes they were stopped but even after starting it we are still getting the same error.
|
|
|
|
|
Hi, Friends
what i have is 1 application in that i run so many stored procedures, but now i have to set parameters to them, that is also i can do but every time i have to set thos parameters acording to the store porcedures
what i want is, if i can list in my program that to 1 procedure how many params r their and put it in any arrey or some thing like that so dinamicaly i can add thos param b 4 running the procedures
For Exam:
SP_SelectEmployee <@EmpId>
in the coding i have to wirte
objCommand = new OleDbCommand(SP_SelectEmployee,objConnection);
objCommand.CommandType=CommandType.StoredProcedure;
param1=SetParameter("@EmpId",OleDbType.VarChar,strKey1.Length);
this is the way i have to set the datatype every time and it lenght so what i want is that if i can get the parameters required and it lenght in an array or in some list so that i can pass thos params same which i want not just wage param type
Please Help Me Gays
Harshad Pednekar
|
|
|
|
|
You can pass the parameters into a hashtable. And then create a loop to pass these parameters one by one to it. You can use following example:
Public Function SelectEmployee(ByVal OracleConn As String, ByVal SPName As String, ByVal crOutput As String, Optional ByVal ParamTable As Hashtable = Nothing) As DataSet
Dim m_objDA As New OracleDataAdapter
Dim m_objDS As New DataSet
Dim m_objDBCmd As OracleCommand
Dim m_objDE As IDictionaryEnumerator
Dim Conn As New OracleConnection(OracleConn)
Try
m_objDBCmd = New OracleCommand
m_objDBCmd.Connection = Conn
m_objDBCmd.CommandType = CommandType.StoredProcedure
m_objDBCmd.CommandText = SPName
If Not IsNothing(ParamTable) Then
m_objDE = ParamTable.GetEnumerator
While m_objDE.MoveNext
m_objDBCmd.Parameters.Add(m_objDE.Key, m_objDE.Value)
End While
End If
m_objDBCmd.Parameters.Add(crOutput, OracleType.Cursor).Direction = ParameterDirection.Output
m_objDA.SelectCommand = m_objDBCmd
m_objDA.Fill(m_objDS)
Catch ex As Exception
'm_objDS = Nothing
Throw ex
Finally
m_objDBCmd = Nothing
m_objDA = Nothing
End Try
Return m_objDS
End Function
|
|
|
|
|
Thank you for the reply friend, but my problem is not this
problem is i have created a procedure and now say i forgot the params of that procedure so what i want is in the vb.net codding i want to get the list of the params and i want to build that procedures and excecute in the database and get the output so say for example i have 1 procedure with some params like
SP_ABC <p1>,<p2>,....
now i dont remember thos params so in my vb program how can i get the list of thos params and it's datatypes
Thankx Again
Regards,
Harshad Pednekar
|
|
|
|