3
Answers

Database control

Photo of baldur

baldur

20y
2k
1
Hello, I am about to start codeing a big project in C# and I am going to be using an Oracle database in it. I wanted to hear from you if you have ever used some third party libraries or Add-ons that have some set of great tools provided for you that will ease the way you browse and select rows and edit and stuff like that.... ????

Answers (3)

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;
         }