Current location: Hot Scripts Forums » Programming Languages » ASP.NET » I have some code that is not working...


I have some code that is not working...

Reply
  #1 (permalink)  
Old 04-17-04, 10:02 PM
techknow's Avatar
techknow techknow is offline
Newbie Coder
 
Join Date: Apr 2004
Location: Lomita, Ca
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy I have some code that is not working...

I have some code that isn't working. I am just cutting my teeth on ASP.Net and am not certain what I am doing wrong.

Can anybody tell me why this returns an error?


<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<Script Runat="Server">

Sub Button_Click( s As Object, e As EventArgs )
Dim conlistings As OleDbConnection
Dim strInsert As String
Dim cmdInsert As OleDbCommand

conlistings = New SqlConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=d:\websites\justoneguy.com\data\listing.mdb " )
strInsert = "Insert Into Listings ( Address, City, Price, Bedrooms, Bathrooms, Views, Description, Comments ) Values ( @Address, @City, @Price, @Bedrooms, @Bathrooms, @Views, @Description, @Comments )"
cmdInsert = New SqlCommand( strInsert, conNorthwind )
cmdInsert.Parameters.Add( "@Address", Address.Text )
cmdInsert.Parameters.Add( "@City", City.Text )
cmdInsert.Parameters.Add( "@Price", Price.Text )
cmdInsert.Parameters.Add( "@Bedrooms", Bedrooms.Text )
cmdInsert.Parameters.Add( "@Bathrooms", Bathrooms.Text )
cmdInsert.Parameters.Add( "@Views", Views.Text )
cmdInsert.Parameters.Add( "@Description", PropDescription.Text )
cmdInsert.Parameters.Add( "@Comments", Comments.Text )
conNorthwind.Open()
cmdINsert.ExecuteNonQuery()
conNorthwind.Close()
End Sub
</Script>

<html>
<head><title>FormInsert.aspx</title></head>
<body>
<form Runat="Server">

<h2>Add New Listing</h2>

<b>Address:</b>
<br>
<asp:TextBox
ID="Address"
Runat="Server" />
<p>
<b>City:</b>
<br>
<asp:TextBox
ID="City"
Runat="Server" />
<p>

<b>Price:</b>
<br>
<asp:TextBox
ID="Price"
Runat="Server" />
<p>

<b>Bedrooms:</b>
<br>
<asp:TextBox
ID="Bedrooms"
Runat="Server" />
<p>

<b>Bathrooms:</b>
<br>
<asp:TextBox
ID="Bathrooms"
Runat="Server" />
<p>

<b>Views:</b>
<br>
<asp:TextBox
ID="Views"
Runat="Server" />
<p>

<b>Description:</b>
<br>
<asp:TextBox
ID="Description"
Runat="server" Columns="3" />
<p>
<b>Comments:</b>
<br>
<asp:TextBox
ID="Comments"
Runat="Server" />
<p>
<asp:Button
Text="Add!"
OnClick="Button_Click"
Runat="Server" />

</form>
</body>
</html>
__________________
Best Regards,

TechKnow
Head-Nerd-In-Charge
Advanced Tech Knowledge

Http://justoneguy.com

http://atkhost.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 04-18-04, 11:30 PM
MadDog MadDog is offline
Code Master
 
Join Date: Aug 2003
Posts: 935
Thanks: 0
Thanked 0 Times in 0 Posts
* topic moved to the correct forum *
__________________
Drew Gauderman
ASP - MSSQL Coder / Buisness Owner / Coder for Hire!
MSN-ICQ-AIM-YIM in Profile

http://www.iportalx.net an easy ASP portal system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 04-19-04, 01:22 PM
techknow's Avatar
techknow techknow is offline
Newbie Coder
 
Join Date: Apr 2004
Location: Lomita, Ca
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for moving this... I fixed it anyway... The Decription var was hosed... Thanks to all!!!
__________________
Best Regards,

TechKnow
Head-Nerd-In-Charge
Advanced Tech Knowledge

Http://justoneguy.com

http://atkhost.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP code to edit a text file mdhall Script Requests 12 12-23-10 05:03 AM
How to sale php code to customer without giving him code pradeep_soft PHP 4 03-12-04 01:10 PM
calendar working until months changed bitesize JavaScript 1 01-13-04 02:50 PM
protecting code in PHP ckb PHP 12 01-02-04 09:53 AM
perl/cgi newbie. hangman.cgi script adding html-like code on web and other trouble Arowana Perl 12 11-13-03 03:24 PM


All times are GMT -5. The time now is 07:15 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.