Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. help in c# web service

help in c# web service

Scheduled Pinned Locked Moved ASP.NET
databasecsharphtmlwcfsysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jacal99
    wrote on last edited by
    #1

    hi i am trying to make a simple web application using web services with c# web matrix i have get the data from html page and i can print it on my aspx page but i could not be able to pass my data to my web services in my web services i want to send my data in access database we i show you my code as under that i used ... this is my html code

    First Name:

    Last Name:

    this is my aspx page code <%@ Page Language="C#" Debug=true %> void Page_Load(object src,EventArgs e) { String fn,ln; fn = Request.Form.Get("fname"); ln=Request.Form.Get("lname"); Response.Write("Your First Name is = " +"<b>" +fn +"</b>" +"<br>"); Response.Write("Your Last Name is = " +"<b>" +ln +"</b>" +"<br>"); } and this is my web services code <%@ WebService language="C#" Debug="True" class="my" %> using System; using System.Web.Services; using System.Xml.Serialization; public class my { [WebMethod] public void Add(string a, string b) { OleDbConnection objConnection = null; OleDbCommand objCmd = null; string strConnection, strSQL; strConnection = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source="+Server.MapPath(".\\database\\t1.mdb"); // Create and open the connection object objConnection = new OleDbConnection(strConnection); objConnection.Open(); // Set the SQL string strSQL = "INSERT INTO sis (fname, lname) VALUES ( a , b)"; // Create the Command and set its properties objCmd = new OleDbCommand(strSQL, objConnection); // here our ionsert query will execute and insertour data in the database. objCmd.ExecuteNonQuery(); objConnection.Close(); } } Mazhar Hussain

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups