C# Npgsql.NpgsqlDataAdapter类代码示例

您所在的位置:网站首页 dataadapterfill C# Npgsql.NpgsqlDataAdapter类代码示例

C# Npgsql.NpgsqlDataAdapter类代码示例

#C# Npgsql.NpgsqlDataAdapter类代码示例| 来源: 网络整理| 查看: 265

本文整理汇总了C#中Npgsql.NpgsqlDataAdapter的典型用法代码示例。如果您正苦于以下问题:C# NpgsqlDataAdapter类的具体用法?C# NpgsqlDataAdapter怎么用?C# NpgsqlDataAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

NpgsqlDataAdapter类属于Npgsql命名空间,在下文中一共展示了NpgsqlDataAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ExecuteSelectQuery public DataTable ExecuteSelectQuery(NpgsqlCommand command, NpgsqlConnection conn) { try { if (conn == null) { return null; } DataTable dataTable = new DataTable(); DataSet dataSet = new DataSet(); NpgsqlDataAdapter dataAdapter = new NpgsqlDataAdapter(command); dataSet.Reset(); dataAdapter.Fill(dataSet); dataTable = dataSet.Tables[0]; conn.Close(); return dataTable.Rows.Count 0) { int _trial = (int)DTuserTrials.Rows[this.comboBox1.SelectedIndex]["tr_id"]; gfd = "Select doc_id, trim(family_name) as family_name, trim(first_name) as first_name from doctors ds where ds.special < 4 and ds.doc_id not in " +"(select doc_id from trial_role where trial_id = '"+_trial+"')"; } NpgsqlDataAdapter getfd = new NpgsqlDataAdapter(gfd,DBExchange.Inst.connectDb); try { getfd.Fill(DTDoctors); } catch (Exception exception) { System.Windows.Forms.MessageBox.Show(exception.Message.ToString() + " getFreeDoctors"); } foreach (DataRow ro in DTDoctors.Rows) { fDoc.Add(ro["family_name"] + " " + ro["first_name"]); } return fDoc; }开发者ID:oeai,项目名称:medx,代码行数:31,代码来源:FormNewResearcher.cs 示例8: pay_Load private void pay_Load(object sender, EventArgs e) { NpgsqlCommand acc_info = new NpgsqlCommand("SELECT DISTINCT " + " places_cnt1.name, " + "places_cnt2.name, " + "public.acc_info.flat " + "FROM " + "public.places_cnt places_cnt2 " + "INNER JOIN public.places_cnt places_cnt1 ON (places_cnt2.parent_id = places_cnt1.plc_id) " + "INNER JOIN public.places_cnt ON (places_cnt1.parent_id = public.places_cnt.plc_id) " + "INNER JOIN public.acc_info ON (places_cnt2.plc_id = public.acc_info.plc_id) " + "WHERE " + " public.acc_info.acc_id = " + all_user.acc_code + "", conn); conn.Open(); NpgsqlDataReader reader = acc_info.ExecuteReader(); while (reader.Read()) { this.Text = "Оплаты по ЛС: " + all_user.acc_code + " Адрес: " + reader[0].ToString() + " " + reader[1].ToString() + " " + reader[2].ToString(); } conn.Close(); DataTable dt = new DataTable(); NpgsqlDataAdapter da = new NpgsqlDataAdapter("SELECT * FROM public.pay WHERE acc_id = " + all_user.acc_code + " ORDER BY date_pay", conn); conn.Open(); da.Fill(dt); conn.Close(); dataGridView1.DataSource = dt; }开发者ID:tatmyanineu,项目名称:servise,代码行数:30,代码来源:pay.cs 示例9: GetChatUsers public static User[] GetChatUsers() { if (ConnectToDatabase()) { string query = "SELECT \"Mail\", \"Username\", \"LastLogin\", \"IsAdmin\", \"ID\" FROM User"; NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, mDatabaseConnection); ds.Reset(); da.Fill(ds); dt = ds.Tables[0]; User[] users = new User[dt.Rows.Count]; int count = 0; foreach (DataRow row in dt.Rows) { User u = new User(); u.UserID = row.Field(dt.Columns[4]); u.Email = row.Field(dt.Columns[0]); u.Username = row.Field(dt.Columns[1]); u.IsAdmin = row.Field(dt.Columns[3]); u.LastOnline = row.Field(dt.Columns[2]); users[count] = u; count++; } DisconnectFromDatabase(); return users; } return null; }开发者ID:ComConDevelopment,项目名称:ComCon,代码行数:30,代码来源:SQLStatements.cs 示例10: ExecuteDataset public DataTable[] ExecuteDataset(CommandType commandType, string query, NpgsqlParameter[] npgsqlParameters) { using (NpgsqlCommand command = GetCommand(query, npgsqlParameters, commandType)) { try { DataSet myDS = new DataSet(); NpgsqlTransaction t = command.Connection.BeginTransaction(); NpgsqlDataAdapter da = new NpgsqlDataAdapter(command); da.Fill(myDS); t.Commit(); DataTable[] tables = new DataTable[myDS.Tables.Count]; myDS.Tables.CopyTo(tables, 0); return tables; } catch (Exception Ex) { throw Ex; } finally { command.Connection.Close(); } } }开发者ID:Kionier,项目名称:npgsql-helper-cs,代码行数:33,代码来源:Npgsql_Helper.cs 示例11: OnExecuteActionActivated protected void OnExecuteActionActivated(Object sender, System.EventArgs e) { String connectionString ="Server=localhost;Database=dbprueba;User Id=dbprueba;Password=1234"; NpgsqlCommand selectCommand = dbConnection.CreateCommand (); selectCommand.CommandText = "select * from categoria"; NpgsqlDataAdapter dbDataAdapter = new NpgsqlDataAdapter(); new NpgsqlCommandBuilder(dbDataAdapter); dbDataAdapter.SelectCommand = selectCommand; DataSet dataset = new Dataset(); dbDataAdapter.Fill (DataSet); //Console.WriteLine("Tables.Count={0}", dataSet.Tables.Count); foreach(DataTable dataTable in dataset.Tables) show (dataTable); DataRow dataRow = dataset.Tables[0].Rows[0]; dataRow["Nombre"] = DateTime.Now.ToString(); Console.WriteLine("Cambios"); show (dataset.Tables[0]); dbDataAdapter.Update(dataset); }开发者ID:daalol,项目名称:ad,代码行数:25,代码来源:MainWindow.cs 示例12: Page_Load protected void Page_Load(object sender, EventArgs e) { string sQuery = "SELECT title, vote_average from movie order by vote_average DESC, release_date ASC LIMIT 20"; string sConn = String.Format("Server=ec2-54-217-202-110.eu-west-1.compute.amazonaws.com;Port=5432;User Id=iwzexazhfjxbbt;Password=4JVMJFooosyfdM5Y79Si-c691D;Database=d8u6uelvine6d6;Protocol=3;SSL=true;SslMode=Require;"); NpgsqlConnection Conn = new NpgsqlConnection(sConn); Conn.Open(); DataSet DS = new DataSet("DS1"); NpgsqlDataAdapter DA = new NpgsqlDataAdapter(); DA.SelectCommand = new NpgsqlCommand(sQuery, Conn); DA.Fill(DS, "DS1"); DS.Tables[0].Columns.Add("Linki", typeof(string)); foreach (DataRow item in DS.Tables[0].Rows) { string link="http://www.omdbapi.com/?t=" + item[0].ToString(); //string link=String.Format("Opis", item[0].ToString()); item[2] = link; } GridView1.DataSource = DS; GridView1.DataBind(); Conn.Close(); }开发者ID:JPuchalski,项目名称:KainosApp,代码行数:28,代码来源:home.aspx.cs 示例13: Button1_Click protected void Button1_Click(object sender, EventArgs e) { int pojemnosc = System.Int32.Parse(TextBox1.Text.ToString()); string typ_sali = DropDownList1.SelectedItem.ToString(); DataSet ds1 = new DataSet(); DataTable dt1 = new DataTable(); NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=postgres;Password=projekt;Database=projekt;"); string sql = "SELECT id_sali FROM sala WHERE typ_sali = '" + typ_sali + "' AND pojemnosc >= '" + pojemnosc + "'"; int ilosc_wyposazen = CheckBoxList1.Items.Count; for (int i = 0; i < ilosc_wyposazen; i++) { if (CheckBoxList1.Items[i].Selected) { string id_wyp = CheckBoxList1.Items[i].Value.ToString(); sql += "INTERSECT SELECT id_sali FROM wyp_sali where id_wyp = '" + id_wyp + "'"; } } conn.Open(); NpgsqlDataAdapter da1 = new NpgsqlDataAdapter(sql, conn); da1.Fill(ds1); dt1 = ds1.Tables[0]; GridView1.DataSource = dt1; GridView1.DataBind(); conn.Close(); }开发者ID:grzesiekkulpa,项目名称:WWW_Rezerwacja_Sal,代码行数:26,代码来源:user_szukaj_sali.aspx.cs 示例14: LoadAll override internal void LoadAll() { try { string query = "SELECT CAST(current_database() AS character varying) AS table_catalog, " + "CAST(nc.nspname AS character varying) AS table_schema, " + "CAST(c.relname AS character varying) AS table_name, " + "CAST('BASE TABLE' AS character varying) AS table_type, d.description " + "FROM pg_namespace nc, pg_user u, pg_class c LEFT OUTER JOIN pg_description d ON d.objoid = c.oid AND d.objsubid = 0 " + "WHERE c.relnamespace = nc.oid AND u.usesysid = c.relowner AND c.relkind= 'r'"; if(!this.dbRoot.ShowSystemData) { query += " AND nc.nspname 'pg_catalog'"; } query += " ORDER BY c.relname"; NpgsqlConnection cn = ConnectionHelper.CreateConnection(this.dbRoot, this.Database.Name); DataTable metaData = new DataTable(); NpgsqlDataAdapter adapter = new NpgsqlDataAdapter(query, cn); adapter.Fill(metaData); cn.Close(); PopulateArray(metaData); } catch {} }开发者ID:attila3453,项目名称:alsing,代码行数:31,代码来源:Tables.cs 示例15: NpgsqlCommandBuilder public NpgsqlCommandBuilder(NpgsqlDataAdapter adapter) : base() { DataAdapter = adapter; this.QuotePrefix = "\""; this.QuoteSuffix = "\""; }开发者ID:Rungee,项目名称:Npgsql2,代码行数:7,代码来源:NpgsqlCommandBuilder.cs

注:本文中的Npgsql.NpgsqlDataAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3