ik ben voor het eerst bezig met een stored procedure, maar ik kom er eigenlijk niet uit, en voorbeeld van andere sites hebben me niet veel goeds opgehaald. (msdn library, google, search functie)
mijn code is als volgt:
en mijn SP:
de waarden heb ik voor een test zelf eerst ingevuld.
ik krijg de volgende foutmelding:
mijn code is als volgt:
ASP:
1
2
3
4
5
6
7
8
9
10
| Set cmdSP = Server.CreateObject("ADODB.Command") cmdSP.ActiveConnection = cnnSimple cmdSP.CommandText = "Weekstaat" cmdSP.CommandType = adCmdStoredProc cmdSP.Parameters.Refresh cmdSP.Parameters.Append cmdSP.CreateParameter("@Start", adDate, 1, , "16-11-2003") cmdSP.Parameters.Append cmdSP.CreateParameter("@Stop", adDate, 1, , "22-11-2003") cmdSP.Parameters.Append cmdSP.CreateParameter("@UserID", adnumeric, 1, , strUserID) Set rstSimple = Server.CreateObject("ADODB.Recordset") rstSimple.Open cmdSP |
en mijn SP:
SQL:
1
2
3
4
5
6
7
8
9
10
11
12
13
| CREATE PROCEDURE [Weekstaat] @Start DateTime, @Stop DateTime, @UserID numeric AS SELECT ISNULL(SUM(dbo.Registratie.Klant_100) + SUM(dbo.Registratie.Klant_125) + SUM(dbo.Registratie.Klant_160) + SUM(dbo.Registratie.CoNet_100) + SUM(dbo.Registratie.CoNet_125) + SUM(dbo.Registratie.CoNet_160), 0) AS Uren, dbo.Time.Datum, dbo.Registratie.Gebruikers_Id FROM dbo.Time LEFT OUTER JOIN dbo.Registratie ON dbo.Time.Datum = dbo.Registratie.Datum WHERE (dbo.Registratie.Type = '2') OR (dbo.Registratie.Type IS NULL) GROUP BY dbo.Time.Datum, dbo.Registratie.Gebruikers_Id HAVING (dbo.Time.Datum >= @Start) AND (dbo.Time.Datum <= @Stop) AND (dbo.Registratie.Gebruikers_Id = @UserID OR dbo.Registratie.Gebruikers_Id IS NULL) GO |
de waarden heb ik voor een test zelf eerst ingevuld.
ik krijg de volgende foutmelding:
kan iemand mij misschien vertellen wat er hier fout gaat?Error Type:
Microsoft OLE DB Provider for SQL Server (0x80004005)
The precision is invalid.
/registratie/test.asp, line 23