.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

how to insert data into database from content page?

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

Please help me to insert data to database from a content page of a master page. My code is working fine when i use my code without master page but with content page of master page i dnt knw what goes wrong. Help me on this please.

thank you

View Complete Post

More Related Resource Links

Correct Way to Insert Data from Text Boxes on ASPX page into SQL Database Using VB


Please help me, I have been trying this for a week now and this is how far I have gotten.


I am new to this, and I am using MS Visual Web Developer Express.


OK - This is what I have come up with, but when I run it I get the following error  (I decided to just try to use a simplified table just to get an understanding of the basic concepts):



Partial Class label_form
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' Declaring variables
        Dim username, labelname, ownersname, address1, address2, city, state, zipcode, country, contactnumber, emailaddress, data_source, con, sql_insert

        ' Check if Necessary Text Is Missing ( will do this once I can get it to work with no empty text boxes)

        ' Get Values from TextBoxes
        username = txtUserName.Text
        labelname = txtLabelName.Text
        ownersname = txtOwnersName

insert the data in database using gridview jquery



I want to use gridview and bind the data and after i want insert the data in database using jquery,

below the link i got for delete


but i want the sample example for insert  row from gridivew and add the database.


review, edit and insert data using 2 diffrent database



is it possible to create a custom list in sharepoint designer to enter a vacation request and using a work flow that goes to the HR department. but when the HR department approve the request the HR can store these requested data into another database?

what i mean is, the employee fill a form in to request some vacation days using a custom list in my wss3 site. i assume that these data will be stored in the WSS_content database. now when the HR department get this filled form they have to store the data of the form in to a database but not in the WSS_Content database.

is this possible?

Estimate weight of BLOB data in our content database

How can I estimate overall size of blob data?

Insert Excel Data via File Upload into sql server database???

Hi all, I have requirement that User can Upload the Excel Sheet Data to sql server Database at once. How i do that Any Article or hint is apperciated.   Regards 

reading xml data and insert into database table

hi friends, .very urgent for me so only i send following script i create for read xml data and to import to table. i got result for reading xml and rows are added to table but the values are showing null pls clarify this problem. thanks alter procedure pizza_sales ( @xml xml ) as begin INSERT INTO pizza_xml (LOC_CODE, CUST_CODE, PRODUCT_ID, INV_TYPE, INV_NO, INV_DT, INV_QTY_IN_INV_UOM, INV_RATE_IN_BS_CURR, INV_VU_IN_INV_CURR, -- TOTAL_DISC_IN_BS_CURR, NET_INV_VU_IN_INV_CURR, NET_INV_VU_IN_BS_CURR, TOTAL_TXES_IN_BS_CURR ) select table1.column1.value('@LOC_CODE','nvarchar(75)'), table1.column1.value('@CUST_CODE','nvarchar(75)'), table1.column1.value('@PROD_CODE','nvarchar(75)'), table1.column1.value('@INV_TYPE','nvarchar(50)'), table1.column1.value('@INV_NO','nvarchar(100)'), table1.column1.value('@INV_DT','datetime'), table1.column1.value('@INV_QTY_IN_INV_UOM','numeric(28,8)'), table1.column1.value('@INV_RATE_IN_BS_CURR','numeric(28,8)'), table1.column1.value('@INV_VU_IN_INV_CURR','numeric(28,8)'), --table1.column1.value('@TOTAL_DISC_IN_BS_CURR','numeric(28,8)'), table1.column1.value('@NET_INV_VU_IN_INV_CURR','numeric(28,8)'), table1.column1.value('@NET_INV_VU_IN_BS_CURR','numeric(28,8)'), table1.column1.value('@TOTAL_TXES_IN_BS_CURR','numeric(28,8)') from @xml.nodes('pizza/pizzaxml')as table1(column1) end declare @id

Basic data type problem with database insert

Hi,I'm trying to write some values into a database, but I think there's an issue with the data types.  Here's what I've got: public static string Hello(string pageId, string inOut) { string itemId = ""; string period = ""; var cookie = HttpContext.Current.Request.Cookies["visitorGUID"].Value; SqlConnection conn; SqlCommand comm; conn = new SqlConnection(GlobalSettings.DbDSN); comm = new SqlCommand("INSERT INTO myTable (memberGUID) VALUES (@memberGUID);", conn); comm.Parameters.Add("@memberGUID", System.Data.SqlDbType.Text); comm.Parameters["@memberGUID"].Value = cookie; try { conn.Open(); comm.ExecuteNonQuery(); return "Item added: cookie = " + cookie + " / pageId = " + pageId + " / inOut = " + inOut + " / pageId = " + pageId + " / itemId = " + itemId + " period = " + period; } catch { return "Item caught: cookie = " + cookie + " / pageId = " + pageId + " / inOut = " + inOut + " / pageId = " + pageId + " / itemId = " + itemId + " period = " + period; } finally { conn.Close(); } } At the moment I'm just trying to insert the value of the cookie into the database as a test.  It works fine when I

How to insert data to Treeview control from database

I want to make a menu used treeview control.so I can get data from database,I want to see in treeview.My database: Tablename: Menu,Field: Id,ParentId,Title.How do see this table in treeviewExample:--Main menu1 -- id is 1,parent id is null        -- sub menu1 -- id is 3,parent id is 1        -- sub menu2 -- id is 4,parent id is 1--Main menu2 -- id is 2,parent id is null         -- sub menu1 -- id is 5,parent id is 2         -- sub menu2 -- id is 6,parent id is 2

How to submit data to a SQL Server database table from a custom page ?

Using SPD, I have created a custom page. It has a form with ASP.NET controls textbox, radio buttons, dropdown, submit button etc., Also, I created a Database connection (to the SQLServer database table) under Database Connections. But not sure how to connect this form to the database connection so that when form data is submitted, the data will be inserted into the table.

How to use Page/Content Field data in a Navigation - how to include images in a navigation?



I look for a hint on how to accomplish the following:

I create a Internet-type of Site based on the Publishing Infrastructure/Features. The site is structured by subsites that are all based on same Masterpages and PageLayouts. In the PageLayouts there are the common fields like Title, Page Content, Page Image. And exactly the last one "Page Image" should appear in the navigation.

Searching the web pointed me to creating a custom PortalSiteMapProvider. In the GetChildNodes I figured out how to get the actual Url to the "Page Image" of a Node in the Sitemap. 

But here I'm stuck. How to I get this information (the image url) delivered to a menu control to actually draw an img src=...?The build-in Nodes don't seem to support such an additional property. And the build-in menu controls (asp:menu, sharepoint:aspmenu) neither.

What do I need to create to make use of the ImageUrl? A custom Web part? or ... ?

Any hints welcome


Thank you


Long time WinXP user, skipped Vista and starting to like 7

INSERT statement and Getting Data From User Into My Database



I have spent 2 days reading and trying to figure this out and everything i have read and every book I have brought only tells how to read info from a database and how to edit info that is in a database and they all display the data in the database!

I have a page created (getinfo.aspx)

On that page I have a correctly configured SQLDatasource (SQLSource1) (it is set to allow insert, edit and delete).

I have 1 fileupload control

I have 2 text boxes

I have 2 drop down list boxes

The 2 drop down list boxes are "binded" to to seperate tables (via 2 other correctly configured SQLDatasource controls 0 but with out permission to insert, edit or delete) and they correctly provide a drop down list for the user to pick from the 51 states and the 200+ Countries. Those work wonderfully).

I also have a Button Control

The table (myFriends) that SQLSource1 is "connected to" has the following columns:
Column Name  Type   Length Nullable
   userID  uniqueidentifier 16 false
   userName  sql_variant  80

Is There Other Methods to Create and INSERT data into A SQL Database besides ADODB.Connection


OK - I have everything working on my Production computer to find out that when I upload my page to my Shared Hosting Server, to find out my application will not work because I do not have high enough permissions to for aspcompat to be true.

This works on my development server which of course I have full access to:


        'Creating Connection Object and opening the database
        con = Server.CreateObject("ADODB.Connection")

        'Done. Close the connection
        con = Nothing
        Response.Write("Your Information was Successfully Added.")


Is there another method to execute my  sql string (which contains my INSERT INTO statement, and is in my .vb code file ) with just a Medium Access Level?  Other wise I will have to purchase a Dedicated server, which currently I can not really afford!


Insert Data on click event into the database



    I want to insert data in to the database by click on button and input box appears.The data entered in input box must insert into the database , so please help me , i am new to asp.net.....Thanks in advance , and also please suggest me some site that can quickly descirbe me asp.net controls and advance properties ,,,,, actuallly i had created lots sites in php. Now time for asp.net ,,, so please help meSmile

insert into database From webform page


Hello, im having trouble with this SQL command what im trying to do is add data from asp.net page into  Database (website target .net framwork 2.0 and i use sqldatasoruce)

I have this form in th page

Product Title: [Txt box]

Product Name: [Txt box]

Product Description: [Txt box]

Product Image: [File upload] {The image will be uploaed to the server stored in folder and image name will added to database}

Add Product [Button]

Can any one let me know how i can do this

Insert data from a web service into an SQL database

Hi there, 

I'm trying to insert data that is entered in a web app form into an SQL database via a web service. 

When I try and run this code I get this error: 

'System.Configuration.ConfigurationManager' does not contain a definition for 'ConnectionString' C:\Users\TestService\Service1.asmx.cs 31 84 TestService

but I have added the System.Configuration namespace. Can anyone tell me what I am doing wrong?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowTest.TestService;

namespace WindowTest
    public partial class Form1 : Form
        public Form1()

        private void btnsave_Click(object sender, EventArgs e)
            WindowTest.TestService.Service1 ssrv = new WindowTest.TestService.Service1();
            Student students = new Student();
            students.Name = txtname.Text;
            students.Matricno = Convert.ToInt32(txtMatric.Text);

How to pass data from content page to master page?



I would like to know if its possible to pass data from content page to master page on code behind. Lets say i have an integer data on content page and i would like to use this data on my master page's menu.

Any ideas?

Thanks in advance.

Best Regards

Get primary key values from insert page and route to details page in a Dynamic Data Domain Service A


I finally figured out how to retrieve primary key values from the insert page template that are inserted via defaults in a SQL Server database. I wanted to get the keys so that I could route the user from the insert page template to the details page template (regardless of whether it’s a custom route or not). There are a number of scenarios where separate insert and details pages are desirable, and routing from the insert page back to the list page is not desirable as Dynamic Data does out of the box. Since I could not find an answer to this problem anywhere with significant effort, I decided I would document it for others, I hope you find it useful - it turns out that it's quite simple under 10 lines of code. I also applied the same idea to a Dynamic Data Entities application which works exactly the same except for two minor changes, I have documented it below as well.

For starters, as is documented plenty elsewhere but bears repeating here, you must first annotate your Entity Data Model with ScaffoldColumn = false for identity columns and guids that get assigned with newid() in thedatabase. This tells Dynamic Data not to attempt to pass a null value from the page through to

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend