B
Bobby Edward
Using Access db with VS2008 (ASP.NET/VB.NET)....
On the INSERT command I get this error: System.Data.OleDb.OleDbException:
Data type mismatch in criteria expression.
I haven't found a solution yet in my research. Any idea what I might be
missing?
**************
Datasource setup as follows:
<asp:AccessDataSource ID="AccessDataSource1"
runat="server"
DataFile="~/BeachFuneral.mdb"
InsertCommand="INSERT INTO [ObitComments]
([ObitId], [CommentBy], [CommentEmail], [CommentRelation],
[CommentApproved], [CommentDateTime], [ObitComment]) VALUES (?, ?, ?, ?, ?,
?, ?)" >
<InsertParameters>
<asparameter Name="ObitId" />
<asparameter Name="CommentBy" />
<asparameter Name="CommentEmail" />
<asparameter Name="CommentRelation" />
<asparameter Name="CommentApproved" />
<asparameter Name="CommentDateTime" />
<asparameter Name="ObitComment" />
</InsertParameters>
</asp:AccessDataSource>
**************
Code to insert as follows:
With Me.AccessDataSource1
.InsertParameters("ObitId").DefaultValue =
Request.QueryString("Id")
.InsertParameters("CommentBy").DefaultValue =
Me.txtFullName.Text
.InsertParameters("CommentEmail").DefaultValue =
Me.txtEmail.Text
.InsertParameters("CommentRelation").DefaultValue =
Me.txtRelationship.Text
.InsertParameters("CommentApproved").DefaultValue = True
.InsertParameters("CommentDateTime").DefaultValue = Now.ToString
.InsertParameters("ObitComment").DefaultValue =
Me.txtComment.Text
End With
Try
Me.AccessDataSource1.Insert()
Catch ex As Exception
Response.Write(ex.ToString)
Exit Sub
Finally
' if ok then move on...
Response.Redirect("Obit.aspx?Id=" & Request.QueryString("Id"))
End Try
On the INSERT command I get this error: System.Data.OleDb.OleDbException:
Data type mismatch in criteria expression.
I haven't found a solution yet in my research. Any idea what I might be
missing?
**************
Datasource setup as follows:
<asp:AccessDataSource ID="AccessDataSource1"
runat="server"
DataFile="~/BeachFuneral.mdb"
InsertCommand="INSERT INTO [ObitComments]
([ObitId], [CommentBy], [CommentEmail], [CommentRelation],
[CommentApproved], [CommentDateTime], [ObitComment]) VALUES (?, ?, ?, ?, ?,
?, ?)" >
<InsertParameters>
<asparameter Name="ObitId" />
<asparameter Name="CommentBy" />
<asparameter Name="CommentEmail" />
<asparameter Name="CommentRelation" />
<asparameter Name="CommentApproved" />
<asparameter Name="CommentDateTime" />
<asparameter Name="ObitComment" />
</InsertParameters>
</asp:AccessDataSource>
**************
Code to insert as follows:
With Me.AccessDataSource1
.InsertParameters("ObitId").DefaultValue =
Request.QueryString("Id")
.InsertParameters("CommentBy").DefaultValue =
Me.txtFullName.Text
.InsertParameters("CommentEmail").DefaultValue =
Me.txtEmail.Text
.InsertParameters("CommentRelation").DefaultValue =
Me.txtRelationship.Text
.InsertParameters("CommentApproved").DefaultValue = True
.InsertParameters("CommentDateTime").DefaultValue = Now.ToString
.InsertParameters("ObitComment").DefaultValue =
Me.txtComment.Text
End With
Try
Me.AccessDataSource1.Insert()
Catch ex As Exception
Response.Write(ex.ToString)
Exit Sub
Finally
' if ok then move on...
Response.Redirect("Obit.aspx?Id=" & Request.QueryString("Id"))
End Try