Welcome to Dream.In.Code
Become an Expert!

Join 149,998 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,362 people online right now. Registration is fast and FREE... Join Now!




insert data in a table

 
Reply to this topicStart new topic

insert data in a table, newbee

SirSummeR
27 Nov, 2006 - 06:29 PM
Post #1

New D.I.C Head
*

Joined: 27 Nov, 2006
Posts: 6


My Contributions
hi!
I'm using visual web developer 2005 and C#

I have created a table with name, address, and phone number. I also created a web form with 3 texboxes and one button.

I really have no ideea how to add values from those texboxes in my table


please help me! I've been looking for this for 1 week and I still did not find any answer
User is offlineProfile CardPM
+Quote Post

eXceed69
RE: Insert Data In A Table
27 Nov, 2006 - 06:33 PM
Post #2

"Super Sentai Knight Of DawN"
Group Icon

Joined: 12 Nov, 2006
Posts: 682



Thanked: 1 times
Dream Kudos: 675
My Contributions
Here some links for your reference:

Sql Insert

Asp Inserting data

If you had more question post your code.
User is offlineProfile CardPM
+Quote Post

SirSummeR
RE: Insert Data In A Table
28 Nov, 2006 - 04:09 PM
Post #3

New D.I.C Head
*

Joined: 27 Nov, 2006
Posts: 6


My Contributions
QUOTE(eXceed69 @ 27 Nov, 2006 - 07:33 PM) *

Here some links for your reference:

Sql Insert

Asp Inserting data

If you had more question post your code.

there is not much code to show
so, this is my addpost.aspx page

CODE
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.date.Text = DateTime.Now.ToString();
        }
    }

    protected void submitAdd_Click(object sender, EventArgs e)
    {

    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Add Post - Blog CMS</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 148px; position: absolute;
            top: 46px" Text="title"></asp:Label>
        <asp:TextBox ID="title" runat="server" Style="z-index: 101; left: 222px; position: absolute;
            top: 44px"></asp:TextBox>
        <asp:TextBox ID="date" runat="server" Style="z-index: 102; left: 222px; position: absolute;
            top: 99px" Font-Bold="True" Font-Underline="False" ReadOnly="True"></asp:TextBox>
        <asp:Label ID="Label2" runat="server" Style="z-index: 103; left: 140px; position: absolute;
            top: 101px" Text="Date"></asp:Label>
        <asp:Label ID="Label3" runat="server" Style="z-index: 104; left: 112px; position: absolute;
            top: 195px" Text="Summary"></asp:Label>
        <asp:TextBox ID="summary" runat="server" Rows="6" Style="z-index: 105; left: 222px;
            position: absolute; top: 154px" TextMode="MultiLine" Width="336px"></asp:TextBox>
        <asp:TextBox ID="post" runat="server" Height="206px" Rows="20" Style="z-index: 106;
            left: 222px; position: absolute; top: 287px" TextMode="MultiLine" Width="444px"></asp:TextBox>
        <asp:Label ID="Label4" runat="server" Style="z-index: 107; left: 142px; position: absolute;
            top: 384px" Text="Post"></asp:Label>
        <asp:Button ID="submitAdd" runat="server" Style="z-index: 109; left: 312px; position: absolute;
            top: 533px" Text="Add Post" OnClick="submitAdd_Click" />
    
    </div>
    </form>
</body>
</html>


When i press the add post button I want the data from those textboxes to be added in my database

My database name is blog.mdf, the table name is post with 6 fields:
CODE
post_id               int
title                    varchar(255)
postdate             datetime
summary            text
post                   text
tstamp                timestamp


someone told me is quite simple to do that but for some reason he don't want to tell me

P.S. please excuse my english
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Insert Data In A Table
28 Nov, 2006 - 07:11 PM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,355



Thanked: 51 times
Dream Kudos: 25
My Contributions
You'll have to write the functionality to connect to a database, and insert the code...there are some examples here:

http://www.samspublishing.com/articles/art...=29463&rl=1

User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 08:18PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month