Home All Groups Group Topic Archive Search About

HELP!! - Data type mismatch in criteria expression

Author
21 Feb 2006 8:15 AM
Bantha
Hi i keep getting a "Data type mismatch in criteria expression. " error
with my asp page in thei sectionof code and i cant seem to find the
cause? can any one help

*******************************************CODE********************************************************


Sub Updatedatabase ()

        Strinsert = "Insert into tblgallery (Gallery_title, Gallery_item,
Author, Author_email,Comments , Gallery_Path, Gallery_thumb_PAth)
values ( @strGalleryTitle, @strGalleryItem, @strAuthor,
@strAuthorEmail, @txtcomments, @Strimage, @strThumb)"
    'Try
        Olecon = New oledbconnection ("Provider    = Microsoft.jet.oledb.4.0;
DATA source = C:\Inetpub\wwwroot\INtranetSite\Database\gallery.mdb")
        oleinsert = new oledbcommand (strinsert, olecon)
        oleinsert.parameters.add("@strgallerytitle", GalleryTitle.text)
        oleinsert.parameters.add("@strgalleryitem", GalleryItem.text)
        oleinsert.parameters.add("@strauthor", author.text)
        oleinsert.parameters.add("@strauthoremail", AuthorEmail.text)
        oleinsert.parameters.add("@txtcomments", txtcomments)
        oleinsert.parameters.add("@strimage", strimage)
        oleinsert.parameters.add("@strthumb", strthumb)
        olecon.open()
        oleinsert.executenonquery()
        olecon.close()
        'Catch exp as exception
            'label.text = exp.message
        'end try

end sub
***********************************************************************************************************

Author
22 Feb 2006 7:54 PM
Cowboy (Gregory A. Beamer) - MVP
Since you are not typing your SqlParameters, there is no indication what they
are expecting, which makes this hard to debug. You also do not have examples
of data, so I cannot tell you which is not working.

Make sure you are not sending a wrong type to a particular parameter by
looking at what the sproc/table expects and what you are passing. The size of
the variable is another potential problem (sending 100 characters into a
varchar(50), for example).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


Show quote
"Bantha" wrote:

> Hi i keep getting a "Data type mismatch in criteria expression. " error
> with my asp page in thei sectionof code and i cant seem to find the
> cause? can any one help
>
> *******************************************CODE********************************************************
>
>
>  Sub Updatedatabase ()
>
>         Strinsert = "Insert into tblgallery (Gallery_title, Gallery_item,
> Author, Author_email,Comments , Gallery_Path, Gallery_thumb_PAth)
> values ( @strGalleryTitle, @strGalleryItem, @strAuthor,
> @strAuthorEmail, @txtcomments, @Strimage, @strThumb)"
>     'Try
>         Olecon = New oledbconnection ("Provider    = Microsoft.jet.oledb.4.0;
> DATA source = C:\Inetpub\wwwroot\INtranetSite\Database\gallery.mdb")
>         oleinsert = new oledbcommand (strinsert, olecon)
>         oleinsert.parameters.add("@strgallerytitle", GalleryTitle.text)
>         oleinsert.parameters.add("@strgalleryitem", GalleryItem.text)
>         oleinsert.parameters.add("@strauthor", author.text)
>         oleinsert.parameters.add("@strauthoremail", AuthorEmail.text)
>         oleinsert.parameters.add("@txtcomments", txtcomments)
>         oleinsert.parameters.add("@strimage", strimage)
>         oleinsert.parameters.add("@strthumb", strthumb)
>         olecon.open()
>         oleinsert.executenonquery()
>         olecon.close()
>         'Catch exp as exception
>             'label.text = exp.message
>         'end try
>
>  end sub
> ***********************************************************************************************************
>
>

AddThis Social Bookmark Button