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


Top 5 Contributors of the Month
SP
satyapriyanayak
Subhransu Sekhar Jena
abhays
DotnetUser
Post New Web Links

Insert data from a web service into an SQL database

Posted By:      Posted Date: November 29, 2010    Points: 0   Category :ASP.Net
 
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?

 
 
WINDOWS APP
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()
        {
            InitializeComponent();
        }

        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);
            students.Progra


View Complete Post


More Related Resource Links

insert the data in database using gridview jquery

  

Hi,

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

http://www.dotnetspark.com/kb/1535-delete-row-from-gridview-and-database-using.aspx

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


Regards


review, edit and insert data using 2 diffrent database

  

hi,

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?


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

Cannot INSERT record using Asp.Net Dynamic Data Domain Service Web Applications

  
 Hi, I am working on a 'Asp.Net Dynamic Data Domain Service Web Application' project using just 2 tables, FAQ_Categories and FAQs. The FAQs table has a foreign key to the FAQ_Categories. The steps are straight forward. Add a new project (Asp.Net Dynamic Data Domain Service Web Applications) Add folders Model ( for Linq2Sql datacontext), Domain (for the Domain Services class) Add Linq2Slql and add the 2 tables to the designer. Build the project. Add the Domain Service Class to the Domain folder. in the wizard select the DataContext, uncheck the Enable Client & Expose ODate checkbox Check bothe table & their corresponding Enable Editing tables checbox Check the Generate Metadata class Click OK. In Global.asax set Scaffold to true and add the DomainService name. Build and run.   Pages List and Detail are working fine. But if I try to insert a new record, I get the error "FaqId is required" Faq_ID is the primary key in the database table and it is set to Identiy. The Datacontext is correct, it marked the FAQ table with <Global.System.Data.Linq.Mapping.ColumnAttribute(Storage:="_CustomerId", AutoSync:=AutoSync.OnInsert, DbType:="Int NOT NULL IDENTITY", IsPrimaryKey:=true, IsDbGenerated:=true)> _   I tried this using Linq2Sql, Entity Framework, And both in VB and C# with the same result. I am using VS20

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 insert data into database from content page?

  

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


INSERT statement and Getting Data From User Into My Database

  

Hello,

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
   uploadUserPhoto

I have 2 text boxes
   txtName
   txtPhone
   txtCity

I have 2 drop down list boxes
   dropState
   dropCountry

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
   btnSubmitInfo

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

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

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")
        con.Open(data_source)
        con.Execute(sql_insert)

        'Done. Close the connection
        con.Close()
        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!

Thanks!


Insert Data on click event into the database

  


Hi,


    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


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

Linq - add data to database then email user the details

  

Hi all

I'm not sure how to structure the code for this but what I want to do is be able to add data to a database, and once this has completed successfully, then email the user to say the details have been added successfully to the database.

I need to:

1. Check that the relevant data has been added into the database then

2. Email the details of the relevant data when completed. 

 

Thanks in advance for your help,

Laura

 

 


Categories: 
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