1
Answer

Asp.net and word 2003

Photo of kawaljit  singh

kawaljit singh

15y
2.7k
1
Hi all,

I am looking for some help

1. using c# i want to open a word template document
2. using c# insert datalist values in a opend word template document.
3. using c# save the word template file as a word documet file.

If someone can plz tell me how to do it....

i hv been working on it for so long-----
some links i workd on....
http://www.codeproject.com/KB/aspnet/wordapplication.aspx etc........

Answers (1)

0
Photo of Sandeep Singh Shekhawat
NA 22.4k 12m 12y
1. imports namesapce in class

using System.Data.SqlClient;

2. create a function in that class which retrun sqlConnection
public static SqlConnection Connection()
         {
            string connectionString = "Data Source=sandeepss-PC;database=Development;user=sa;password=knowdev";
            SqlConnection con = new SqlConnection();
            con.ConnectionString = connectionString;
            return con;
        }

3 create a function which return all login names in a data Table
 public static DataTable getUserLogin()
         {
             DataTable dt = new DataTable();
             SqlConnection con = Connection();
             SqlCommand cmd = new SqlCommand();
             cmd.CommandText = "select userLogin from tbl_login";
             cmd.Connection = con;
             con.Open();
             SqlDataReader reader = cmd.ExecuteReader();
             dt.Load(reader);
             return dt;
         }