Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dim Command As New SqlCommand("[---].[usp_-----]", pcnn)

With Command.Parameters
.AddWithValue("@nQID", pnID)
End With

Dim dt As DataTable = FillDataTable(Command)
Return dt.Rows(0).Item("dCr")


Note: stored procedure inputs were there please ignore ----'s.
Thank You!

What I have tried:

I debugged the above lines of code , there was nothing inside.
Posted
Updated 14-Dec-21 3:21am

We can't help you - there just isn't enough information there. Heck, there isn;t any information there!

So start by using the debugger to look at exactly what your command string is: then check that against your actual db and it's stored procedures. And check the value in pnID at the same time.

If that all looks right, look at the actual stored procedure and see what it does.

Then use SSMS to run the code from the SP as a query - with the pnID value you checked earlier - and see what it returns.
If it's no rows, look at your DB table data and find out why no rows match.

Hopefully, something there will lead you to the problem, and from there it's probably a small step to a solution.

But we can't do any of that for you: we have no access to your code while it is running, or your DB at all!
 
Share this answer
 
Comments
CHill60 14-Dec-21 9:21am    
aargh - sorry. Overlap. Need to refresh my screen before posting :-(
The problem is in the method FillDataTable() - you have not shared the code for that method so we cannot be more explicit.

FillDataTable is returning an empty table so dt.Rows(0) does not exist
 
Share this answer
 
Comments
RandalKeith 14-Dec-21 9:45am    
Thank You for the quick response I will check and get back to you!
CHill60 14-Dec-21 12:47pm    
Looking at your code I would say it's the SQL that you are passing into FillDataTable - first thing to check. See Solution 1

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900