store procedure problem

A

Agnes

my stored procedure runs very well. However, as I use .net to get the
dataset .It is fail, no data returns .
what's wrong with my code ?
Please help.

With cmdSearch
.Connection = conPubs
.CommandText = "dbo.companyinfo_shipper_List"
.CommandType = CommandType.StoredProcedure
End With

prmSearch = cmdSearch.Parameters.Add("@name", 'F%'))
prmSearch.Direction = ParameterDirection.Input
prmSearch.SqlDbType = SqlDbType.Char
Dim daSearchResult As New SqlDataAdapter(cmdSearch)
conPubs.Open()
daSearchResult.Fill(dsSearchResult)

---------------------------------------------
CREATE PROCEDURE dbo.companyinfo_shipper_list
@name char(40)
as
select code,name,address1,address2,address3,address4 ,telno,faxno
from companyheader
where shippersw = 1 and name like @name
order by name
 
C

Cor Ligthert

Hi Agnes,

I am not sure however I think you did mean something as:

cmdSearch.Parameters.Add("@name", "F%")

And than delete this part
prmSearch = cmdSearch.Parameters.Add("@name", 'F%'))
prmSearch.Direction = ParameterDirection.Input
prmSearch.SqlDbType = SqlDbType.Char

As far as I can see that does nothing.

However it is sunday, so maybe when this is not right you can ask it as well
in the newsgroup

Cor

Adonet
<
Web interface:

<http://communities2.microsoft.com/communities/newsgroups/en-us/?dg=microsof
t.public.dotnet.framework.adonet>

I hope this helps?

Cor
 
C

Charlie Smith

Agnes said:
my stored procedure runs very well. However, as I use .net to get the
dataset .It is fail, no data returns .

Agnes,

Try changing the parameter to varchar(40).

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top