Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

not all variables bound

Status
Not open for further replies.

kebele

MIS
Joined
Jul 31, 2006
Messages
107
Location
US
I am trying to bound my sql statement to with this SqlDataSource1.SelectCommand and i am getting an error message.I am also passing one parameter to this sql statement using the below code. your help is really appreciated.


ORA-01008: not all variables bound

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OracleClient.OracleException: ORA-01008: not all variables bound


Sub VendorSearch()

Dim Sql As String = " select * from vendor where vnamel like :VendorName"
Dim myCommand3 As OracleCommand = New OracleCommand(Sql, New OracleConnection(GetConnectionString()))

myCommand3.Parameters.AddWithValue(":VendorName", "%" & txtVendorName.Text & "%")
Dim myAdapter3 As New OracleDataAdapter(myCommand3)

Response.Write("Sql " & "<br/>" & Sql & "<hr/>")
SqlDataSource1.SelectCommand = Sql

End Sub
 
Try with the following...

Code:
myCommand3.Parameters.Add("@VendorName", [i]oracle datatype[/i]).Value =  "%" & txtVendorName.Text & "%"

Sharing the best from my side...

--Prashant--
 
Thanks prashant for the tip.since i am using sqldatasource i had to add the paramter like what i did below.one more question though, how can i make sure the value that entered by the user is always upper case since the info. that i need to pull is upper case in the database. Is it possible to surround the

Dim Sql As String = " select * from vendor where vnamel like UCASE(:VendorName)" I am not sure if this is right.

thanks for the help i get from you guys. It really mean a lot to me.



<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" >
<SelectParameters>
<asp:ControlParameter ControlID="txtVendorName" Name="VendorName" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>


Sub VendorSearch()

Dim Sql As String = " select * from vendor where vnamel like :VendorName"
SqlDataSource1.SelectCommand = Sql

End Sub

 
You can use the functions with SQL query. Try using this way...in SQL server
Code:
select * from table_name where table_column = upper('xyz')

Sharing the best from my side...

--Prashant--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top