Solved

Insert error

Posted on 2004-08-30
5
190 Views
Last Modified: 2006-11-17
Hi

I have developed a web page in dreamweaver and am getting a error when trying to insert information.  It is a access 2000 database.  This is the error when I am running the page in explorer.

This is the insert statment....

<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO Request(School, School_Priority, Date, Improvement, Rational, Estimated_Cost, Employee_Id) VALUES (?, ?, ?, ?, ?, ?, ?)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_connEnhancement") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_connEnhancement") %>'
Expression='<%# Request.Form("MM_insert") = "form1" %>'
CreateDataSet="false"
SuccessURL='<%# "request Added.aspx" %>'
Debug="true"


Please help, the error in explorer says System.Dat.OleDb.OleDbException:Syntax error in INSERT INTO statement


Thanks
Denise
0
Comment
Question by:neicy62
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 11932968
use AddParameter to add parameters:

cmd.AddParameter("@School", SybaseDbType.Varchar);
0
 

Author Comment

by:neicy62
ID: 11953087
Hey there...

I tried that but not sure were to put statment in code.  I did something to and now I am getting an error of
SystemData.OleDb.OleDbException.
Operation must use an updateable query.

Here is the code:

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO Request (Employee_ID, Estimated_Cost, Improvement, Rational, Request_Date, School, School_Priority) VALUES (?, ?, ?, ?, ?, ?, ?)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_connEnhancement") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_connEnhancement") %>'
Expression='<%# Request.Form("MM_insert") = "form1" %>'
CreateDataSet="false"
SuccessURL='<%# "request Added.aspx" %>'
Debug="true"
><Parameters>
  <Parameter Name="@Employee_ID" Value='<%# IIf((Request.Form("Employee_ID") <> Nothing), Request.Form("Employee_ID"), "") %>' Type="Integer" />  
  <Parameter Name="@Estimated_Cost" Value='<%# IIf((Request.Form("Estimated_Cost") <> Nothing), Request.Form("Estimated_Cost"), "") %>' Type="Currency" />  
  <Parameter Name="@Improvement" Value='<%# IIf((Request.Form("Improvement") <> Nothing), Request.Form("Improvement"), "") %>' Type="WChar" />  
  <Parameter Name="@Rational" Value='<%# IIf((Request.Form("Rational") <> Nothing), Request.Form("Rational"), "") %>' Type="WChar" />  
  <Parameter Name="@Request_Date" Value='<%# IIf((Request.Form("Date") <> Nothing), Request.Form("Date"), "") %>' Type="Date" />  
  <Parameter Name="@School" Value='<%# IIf((Request.Form("School") <> Nothing), Request.Form("School"), "") %>' Type="WChar" />  
  <Parameter Name="@School_Priority" Value='<%# IIf((Request.Form("School_Priority") <> Nothing), Request.Form("School_Priority"), "") %>' Type="Integer" />
</Parameters>
</MM:Insert>
<MM:DataSet
id="dsschool"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_connEnhancement") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_connEnhancement") %>'
CommandText='<%# "SELECT School_Name  FROM Building" %>'
Debug="true"
>
  <Parameters>
  <Parameter  Name="@school"  Value='<%# IIf((Request.QueryString("school") <> Nothing), Request.QueryString("school"), "%") %>'  Type="VarWChar"   />    </Parameters>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
      color: #000000;
}
body {
      background-color: #00CC99;
}
-->
</style></head>
<body>
<h1 align="center">Add New Building Enhancement Request</h1>
<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<form method="post" name="form1" runat="server">
  <table align="center">
    <tr valign="baseline">
      <td width="164" align="right" nowrap>Date:</td>
      <td width="210"><asp:textbox id="Date" TextMode="SingleLine" Columns="32" runat="server" />
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Employee_ID:</td>
      <td><asp:textbox id="Employee_ID" TextMode="SingleLine" Columns="32" runat="server" />
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Estimated_Cost:</td>
      <td><asp:textbox id="Estimated_Cost" TextMode="SingleLine" Columns="32" runat="server" />
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Improvement:</td>
      <td><asp:textbox id="Improvement" TextMode="MultiLine" Columns="32" runat="server" />
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Rational:</td>
      <td><asp:textbox id="Rational" TextMode="MultiLine" Columns="32" runat="server" />
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">School:</td>
      <td><% School.SelectedIndex = School.Items.IndexOf(School.Items.FindByValue("")) %>
          <asp:dropdownlist id="School"
              DataSource="<%# dsschool.DefaultView %>"
              DataTextField="School_Name"
              DataValueField="School_Name"
                    runat="server"> </asp:dropdownlist>
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">School_Priority:</td>
      <td><asp:textbox id="School_Priority" TextMode="SingleLine" Columns="32" runat="server" />
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">&nbsp;</td>
      <td><input type="submit" value="Insert record"></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
</body>
</html>

Thanks for the help
Denise
0
 

Author Comment

by:neicy62
ID: 11962959
Hey there...

Just wondering if anyone could help  me with my problem

Thanks

Denise
0
 

Author Comment

by:neicy62
ID: 11996334
Hi there...

Have not heard back still wondering if anyone can help with my problem.

Thanks

Denise
0
 

Author Comment

by:neicy62
ID: 12112186
Hi

You can close this question 0 points awarded, figured it out for myself

Thanks
Denise
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question