Monday, December 17, 2007

What can I do if the error Too-Few-Parameters occurred?

What can I do if the error Too-Few-Parameters occurred?


The error of wrong field name normally happened in this type of ASP scripts:



<%

Set conn = Server.CreateObject("Adodb.Connection")

conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")

Set rs = Server.CreateObject("Adodb.Recordset")

strSQL ="SELECT MembersName FROM Member;" 'The error occured&ldots;

rs.Open strSQL,conn,1,3

If Not rs.EOF Then

Response.Write("The first record is " & rs.fields(0) & "
")

End If

rs.Close

Set rs = Nothing

%>

This kind of error occurred frequently while you used a wrong field name to call the value in the table.

For example:

When your table contains a field name call "MemberName", but you mistype "MembersName", errors will occured.

Another mistake will be made, such as, you used the field name that was never used in the table.

When you see the error message as shown at the diagram above, you will need to correct the ASP codes to avoid the error message.


No comments: