Working With Infopath 2007

20
///Code—webservice to insert data into data into the database using System; using System.Data; using System.Web; using System.Collections; using System.Web.Services; using System.Web.Services.Protocols; using System.ComponentModel; using System.Data.SqlClient; namespace inwebservice { public class Service1 : System.Web.Services.WebService { [WebMethod] public bool information(string strSno,string strSname) { try { SqlConnection cn = new SqlConnection("Data Source= -;Initial Catalog=Assignment2;user id=kiprms;Password= cn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; int sno = int.Parse(strSno); string sname = strSname; cmd.CommandText = "insert into student values (" + sno + ",'" + sname + "')"; cmd.ExecuteNonQuery(); cn.Close(); return true; } catch { return false; } } } }

description

 

Transcript of Working With Infopath 2007

Page 1: Working With Infopath 2007

///Code—webservice to insert data into data into the database

using System;using System.Data;using System.Web;using System.Collections;using System.Web.Services;using System.Web.Services.Protocols;using System.ComponentModel;using System.Data.SqlClient;

namespace inwebservice{ public class Service1 : System.Web.Services.WebService {

[WebMethod] public bool information(string strSno,string strSname) { try { SqlConnection cn = new SqlConnection("Data Source= -;Initial Catalog=Assignment2;user id=kiprms;Password= cn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; int sno = int.Parse(strSno); string sname = strSname; cmd.CommandText = "insert into student values (" + sno + ",'" + sname + "')"; cmd.ExecuteNonQuery(); cn.Close(); return true; } catch { return false; } } }}

Page 2: Working With Infopath 2007

2) Run the web service

3)click the method “”information””

Page 3: Working With Infopath 2007

4)Then enter the values in the following document

5) after clicking the invoke button we are going to get the following form

Page 4: Working With Infopath 2007

6)Data is inserted successfully

7)copy the url

Page 5: Working With Infopath 2007

6) Now working with infopath form.

7) Goto All programsMicrosoft officeMicrosoft office infopath 2007

8)A form will be opened in following way in that click design form template

Page 6: Working With Infopath 2007

9)A new form window will be opened in that click blank icon and press ok.

10)A new infopath form will be opened in the design mode click controls in the design task and add the required controls

Page 7: Working With Infopath 2007

11)In that form window goto tools and select submit options

12) right click on the first textbox and select textbox properties in that select the type of the text to be entered the textbox, and in the same way for the remaining text box

Page 8: Working With Infopath 2007

12) a new window will be opened in that unclear the “allow users to submit the form” and select webservice in the dropdown list finally click advanced in that unclear that use custom messages write the comments in the fields,

13)click add button in the submit options window.

14)paste the url of the webservice the following window

Page 9: Working With Infopath 2007

And then click next

15)select the web method in the following window and the press next

Page 10: Working With Infopath 2007

16) Associate each and every field in info path form with fields in web service by clicking the icon behind field or group

Page 11: Working With Infopath 2007

17)Then unclear the submit data as a string field and finally click next

Page 12: Working With Infopath 2007

18)Finally click finish

19) Then press ok in the submit options button

20) in the infopath form click file menu and then select publish button

Page 13: Working With Infopath 2007

21) save the form.

Page 14: Working With Infopath 2007

22) unclear the check box corresponding a new network location and then click next

23)Browse the location of the infopath form save it with different name for example newinfopath.xsn and then click next

Page 15: Working With Infopath 2007
Page 16: Working With Infopath 2007

24) Finally publish the document

Page 17: Working With Infopath 2007

25) if we publish the document now we can enter data when we click the button we will get a form (“success”) or a form with (“failure”) if it is success then we can come to the conclusion that data is successfully entered into the database.

How to work with infopath form in offline

1) Save the infopath form in the required location after publishing when ever it is needed we can directly enter the data into the database.

Page 18: Working With Infopath 2007

How to deploy infopath form in MOSS 2007

1) Open required site in the site actions options select create option then in the new form select create form templates options where we can directly infopath form from saved location