IN operator is not working with query in VB.Net
Hi, this is my stored procedure -
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
drop procedure if exists SP_Login;
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `SP_Login`(_action varchar(10),
_uname varchar(500))
BEGIN
if _action = 'SelectU' then
SELECT Name as CompanyName, Uname as UserName, Pwd,
Mobile as MobileNumber, limax as NumberofVehicles, Address,
RID as UserId, parent_user, child_user, ProfileRights, AllocationRights,
GeneralRights from Regis
WHERE UName IN (_uname) ;
end if;
END
and this is my VB.Net code -
dtUserDetails = DBClass.GetDataTableForLogin("SelectU", Children, "")
grdUserProfile.DataSource = dtUserDetails
Public Function GetDataTableForLogin(ByVal action As String, ByVal uname As String) As DataTable
Dim dtdatatable As New DataTable
Dim conn As OdbcConnection = New OdbcConnection(ConfigurationManager.ConnectionStrings("DBConnection").ToString)
Dim cmd As OdbcCommand = conn.CreateCommand
cmd.CommandText = "{call SP_Login(?,?)}"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("_action", action)
cmd.Parameters.AddWithValue("_uname", uname))
conn.Open()
Dim da As New OdbcDataAdapter(cmd)
da.Fill(dtdatatable)
da.Dispose()
conn.Close()
Return dtdatatable
when i am running my code uname value i am getting,but after that in datatable it is coming blank.
tell me is there any problem with my code?