Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 30th, 2006, 02:26 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP.NET using Webmatrix

hi!

I am using a form to insert the data into a database. But i am getting an error again & again.

Here is the code that i've used:

<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
<script runat="server">

    Sub Button1_Click(sender As Object, e As EventArgs)

        Dim connectionString as String = "server='(local)';user id='sa';password='soumya';database='MatrixOrders;"

        Dim MySQL as string = "Insert into schedule (EmployeeId, Department Name, Date, Start Time, Finish Timem, Notes) " & _
            "Values (@EmployeeID, @Department Name, @Date, @Start Time, @Finish Time, @Notes)"


        Dim MyConn As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionStri ng)
        'Dim MyConn as New SQLConnection(strConn)'


        Dim Cmd as New System.Data.SqlClient.SQLCommand(MySQL, MyConn)
        With Cmd.Parameters
            .Add(New SQLParameter("@EmployeeID", frmTextBox1.text))
            .Add(New SQLParameter("@Department Name", frmTextBox2.text))
            .Add(New SQLParameter("@Date", frmTextBox3.text))
            .Add(New SQLParameter("@Start Time", frmTextBox6.text))
            .Add(New System.Data.SqlClient.SQLParameter("@Finish Time", frmTextBox7.text))
            .Add(New SQLParameter("@Notes", frmTextBox9.text))

        End With
        MyConn.Open()
        Cmd.ExecuteNonQuery()
        'Put your Success statement Here
        'Create a label on the page and assign the success statement to the label's text value, like:
        'Label1.Text="Your inormation has been successfully received. " & "We will get back to you as soon as possible"
        'Remember to Import the SQLClient Namespace also
        MyConn.Close()
    End Sub





    Sub TextBox1_TextChanged(sender As Object, e As EventArgs)
    'Employee ID'
    End Sub

    Sub TextBox2_TextChanged(sender As Object, e As EventArgs)
    'Department Name'
    End Sub

    Sub TextBox6_TextChanged(sender As Object, e As EventArgs)
    'Start Time'
    End Sub

    Sub TextBox7_TextChanged(sender As Object, e As EventArgs)
    'Finish Time'
    End Sub

    Sub TextBox9_TextChanged(sender As Object, e As EventArgs)
    'Notes'
    End Sub

    Sub TextBox3_TextChanged(sender As Object, e As EventArgs)
    'Date'
    End Sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <h2 align="center">PLEASE FILL UP THE FIELDS GIVEN BELOW !
        </h2>
        <h2 align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EMPLOYEE ID :
        </h2>
        <h2 align="center">
            <asp:TextBox id="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
        </h2>
        <h2 align="left"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; DEPARTMENT
            NAME :</strong>
        </h2>
        <h2 align="center">
            <asp:TextBox id="TextBox2" runat="server" OnTextChanged="TextBox2_TextChanged" Width="265px"></asp:TextBox>
        </h2>
        <h2 align="left">
        </h2>
        <h2 align="center">
        </h2>
        <h2 align="left">
        </h2>
        <h2 align="center">
        </h2>
        <h2 align="left"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; DATE
            :</strong>
        </h2>
        <p align="center">
            <asp:TextBox id="TextBox3" runat="server" OnTextChanged="TextBox3_TextChanged"></asp:TextBox>
        </p>
        <h2 align="center">
        </h2>
        <h2 align="left"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; </strong><strong>START
            TIME :</strong>
        </h2>
        <h2 align="center">
            <asp:TextBox id="TextBox6" runat="server" OnTextChanged="TextBox6_TextChanged" Width="217px"></asp:TextBox>
        </h2>
        <h2 align="left"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; END TIME
            :</strong>
        </h2>
        <h2 align="center">
            <asp:TextBox id="TextBox7" runat="server" OnTextChanged="TextBox7_TextChanged" Width="217px"></asp:TextBox>
        </h2>
        <h2 align="left">
        </h2>
        <h2 align="center">
        </h2>
        <h2 align="left"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; NOTES
            :</strong>
        </h2>
        <h2 align="center">
            <asp:TextBox id="TextBox9" runat="server" OnTextChanged="TextBox9_TextChanged" Width="336px" Height="50px"></asp:TextBox>
        </h2>
        <h2 align="left">
            <asp:Button id="Button1" onclick="Button1_Click" runat="server" Width="127px" n="n" Text="SUBMIT"></asp:Button>
        </h2>
        <p align="left">
        </p>
        <p align="left">
            <wmx:MxDataGrid id="MxDataGrid1" runat="server"></wmx:MxDataGrid>
        </p>
    </form>
</body>
</html>

WHAT IS WRONG WITH THIS CODE? Waiting for a reply as soon as possible.


yash
Reply With Quote
  #2 (permalink)  
Old July 1st, 2006, 04:28 PM
Authorized User
Points: 375, Level: 6
Points: 375, Level: 6 Points: 375, Level: 6 Points: 375, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2006
Location: New Delhi,India.
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to anujrathi Send a message via MSN to anujrathi Send a message via Yahoo to anujrathi
Default

Hi,
First of all, pls change ur connection string..

 Dim connectionString as String = "server=locathost;user id=sa;password=soumya;database=MatrixOrders"

There is no need to add any single quotions, in connection string.
If ur application will still be seen error, then pls specify the erroe message in ur qusetion.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP WebMatrix closes unexpectedly asp_princess ASP.NET 1.0 and 1.1 Basics 0 June 28th, 2007 09:36 AM
Webmatrix chapter 3 jdelpay ASP.NET 1.0 and 1.1 Basics 0 October 18th, 2004 02:35 PM
Crystal Report in WebMatrix sacred21 Crystal Reports 0 September 28th, 2004 08:25 PM
Dreamweaver and webmatrix paggy Dreamweaver (all versions) 0 March 10th, 2004 03:30 AM



All times are GMT -4. The time now is 12:07 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.