Sie sind auf Seite 1von 3

<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="myconnection" value="Data source=.

; initial catalog=hospital_1; ui d=sa;password=sujan;"/> </appSettings> </configuration> ******************************************************************************** ***** string str = ConfigurationSettings.AppSettings["myconnection"]; ******************************************************************************** ***** public DataTable serch_dotorprofile(string name) { SqlConnection cn = new SqlConnection(str); cn.Open(); string sql = "select * from tbl_docprofile where doctor_name like ' " + name + "%'"; SqlDataAdapter da = new SqlDataAdapter(sql, cn); DataSet ds = new DataSet(); da.Fill(ds, "tbl_docprofile"); return ds.Tables["tbl_docprofile"]; } ******************************************************************************** ***** public bool close_or_not(string pay, string clo,string billno) { SqlConnection cn = new SqlConnection(str); string sql = "select * from tbl_incomelist where date= '" + clo + "' and department='" + billno + "' and remark='"+pay+"'"; //stored procedure SqlCommand cmd = new SqlCommand(sql, cn); SqlDataReader da = null; try { cn.Open(); da = cmd.ExecuteReader(); if (da.Read()) { return true; } else { return false; } } catch (Exception ex) { throw ex; } finally { cn.Close(); } } ********************************************************************************

***** public string delete_ad_depo_acc(Int32 hh) { SqlConnection cn = new SqlConnection(str); cn.Open(); string sqll = "delete from tbl_advanced_deposit where sn =" + hh + " "; SqlCommand cmd = new SqlCommand(sqll, cn); try { // cn.Open(); cmd.ExecuteNonQuery(); // for insert,delete and updata use executenonquery(); //for select use executereader(); //for select with aggregate function use executescalar(); return "Admitted Added"; } catch (Exception ex) { throw ex; } finally { cn.Close(); } } **************************************************************************** public string add_nursing_billno(double billno) { SqlConnection cn = new SqlConnection(str); cn.Open(); string sqll = "insert into nursing_billno (billno) values(" + billn o + ")"; SqlCommand cmd = new SqlCommand(sqll, cn); try { // cn.Open(); cmd.ExecuteNonQuery(); // for insert,delete and updata use executenonquery(); //for select use executereader(); //for select with aggregate function use executescalar(); return "successfully updated service information"; } catch (Exception ex) { throw ex; } finally { cn.Close(); } }

***************************************************************************** public string update_xrayttbl(string date, string open) { SqlConnection cn = new SqlConnection(str); cn.Open(); string sqll = "update tbl_xray set incomedate='" + date + "' where i ncomedate='" + open + "' "; SqlCommand cmd = new SqlCommand(sqll, cn); try { // cn.Open(); cmd.ExecuteNonQuery(); // for insert,delete and updata use executenonquery(); //for select use executereader(); //for select with aggregate function use executescalar(); return "successfully updated service information"; } catch (Exception ex) { throw ex; } finally { cn.Close(); } } ******************************************************************************** * public string addnepalidatet0_lab(double billno, string amount, string nepalidat e, double tender, string enter) { SqlConnection cn = new SqlConnection(str); // appointment infor mation insert string sql = "insert into tbl_wordslab (billno,amountword,nepalidate ,tender,enter) values(" + billno + ",'" + amount + "','" + nepalidate + "'," + t ender + ",'" + enter + "')"; SqlCommand cmd = new SqlCommand(sql, cn); try { cn.Open(); cmd.ExecuteNonQuery(); // for insert,delete and updata use executenonquery(); //for select use executereader(); //for select with aggregate function use executescalar(); return "successfully inserted income information"; } catch (Exception ex) { throw ex; } finally { cn.Close(); } }

Das könnte Ihnen auch gefallen