Jump to content

add record to MS Database


nemo

Recommended Posts

I'm tying to add to access database but I'm always getting an error. but if I changes the variavles in the VALUES by constants it worked fineAny help is appriciatedhere is the code<script runat="server">Private Sub Insertguest(ByVal Source As Object, ByVal e As EventArgs)SqlDataSource1.Insert()End Sub ' Insertguest</Script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"><title>Untitled Page</title></head><body> <asp:SqlDataSourceid="SqlDataSource1"runat="server"ProviderName="System.Data.Odbc"DataSourceMode="DataSet"ConnectionString="dsn=eventdb;"SelectCommand="SELECT GuestLastName, GuestFirstName, Guestsufix FROM guest"Insertcommand="INSERT INTO guest (GuestLastName,GuestFirstName,Guestsufix) VALUES (@lstName,@firstname,@suff)"><insertparameters><asp:formparameter name="lstName" FormField="SPLastname" Type="String" /><asp:formparameter name="firstname" formfield="SPFirstName" Type="String" Size="22" /><asp:formparameter name="suff" formfield="SPSuffix" Type="String" Size="22" /></insertparameters></asp:SqlDataSource><p><asp:Button ID="spsubmit" runat="server" Style="z-index: 106; left: 35px; position: absolute;top: 421px" Text="Sumit"onclick="InsertGuest" />

Link to comment
Share on other sites

what is contained in the eventdb variable???This is a sample of an Access connection string I use

Provider=Microsoft.Jet.OLEDB.4.0;data source=C:\Inetpub\wwwroot\........\tpc.mdb

I haven't used this new control yet...you are using .Net 2.0 right???

Link to comment
Share on other sites

what is contained in the eventdb variable???This is a sample of an Access connection string I use
Provider=Microsoft.Jet.OLEDB.4.0;data source=C:\Inetpub\wwwroot\........\tpc.mdb

I haven't used this new control yet...you are using .Net 2.0 right???

eventdb points to the physical database on the local drive. I'm not sure but I have the fellimg that the problem in the VALUES ( @lstName,@firstname,@suff) because if I tried VALUES ( 'last test','first test','suff test') that will work fine and add record to the table
Link to comment
Share on other sites

Okay that sounds logical. Did you get this code form a tutorial??? If so please provide the link to it.Have you used an approach like this before? Did it work? Can you post some code from that.I am sorry I haven't been more help...I have not used this control yet (I'm still in transition from 1.1 to 2.0).

Link to comment
Share on other sites

Okay that sounds logical. Did you get this code form a tutorial??? If so please provide the link to it.Have you used an approach like this before? Did it work? Can you post some code from that.I am sorry I haven't been more help...I have not used this control yet (I'm still in transition from 1.1 to 2.0).

thanks anyway if I figured it out I'll post the sokution
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...