如何通過perl連接infobright DB?如何通過perl連接infobright DB?
1
A
回答
2
With DBD-mysql。請用
perl Makefile.PL --mysql_config=/usr/local/infobright-3.5.2-x86_64/bin/mysql_config
或其他類似安裝。
1
您可以使用任何標準的數據庫連接連接到Infobright,您可以使用MySQL連接。 Daxim是正確的 - DBD是連接數據庫的最常見方式之一。在您的DBD配置中,您只需將端口號從3306(MysQL)更改爲5029(Infobright)即可。其餘的都是一樣的。
-1
class Dataconnection
{
public static SqlConnection NewCon;
//public static string ConString = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
public static SqlConnection GetConnection()
{
NewCon = new SqlConnection("Data Source=Absar;Initial Catalog=star_fancy_stock;Integrated Security=True;");
return NewCon;
}
}
/////////////////////// 2ND //////////////////
namespace star_fancy_stock
{
class Dbcontrol
{
public static SqlConnection NewCon;
SqlDataReader dr;
public int dataread = 0;
public Dbcontrol()
{ }
public SqlDataReader reader(String sql)
{
try {
NewCon = Dataconnection.GetConnection();
NewCon.Open();
SqlCommand newconn = new SqlCommand(sql, NewCon);
dr = newconn.ExecuteReader();
return dr;
}
catch (Exception ex) { MessageBox.Show(ex.Message); return dr; }
}
public int writer(String sql)
{
try
{
dataread = 0;
NewCon = Dataconnection.GetConnection();
NewCon.Open();
SqlCommand newconn = new SqlCommand(sql, NewCon);
dataread = newconn.ExecuteNonQuery();
NewCon.Close();
return dataread;
}
catch (Exception ex) { MessageBox.Show(ex.Message); return dataread; }
}
}
}
0
** ** INSERT
if (textBox4.Text == "")
{
MessageBox.Show("Please provide Selling1 ", "Item Update", MessageBoxButtons.OK);
textBox4.Focus();
return;
}
int i = dbcon.writer("insert into Item_Master(Item_Code,Name,Description,Selling1,Selling2,Reorder_level,Reorder_Quantity,Active) Values ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "')");
if (i == 1)
{
MessageBox.Show("Record added succesfully", "Item Table");
Itemview();//disply ll
iclear();
}
else
{ MessageBox.Show("Record unsuccesfully for Item "); }
}
** ** INSERT
Dbcontrol dbcon = new Dbcontrol();
SqlDataReader dr = null;
string date = DateTime.Now.ToString("M/d/yyyy");
查看/搜索
listView1.Items.Clear();
dr = dbcon.reader("select cateid,brand,type,deta,date from emcategory where cateid like '%" + txtseacrchid.Text + "%'");
while (dr.Read())
{
string sid = dr["cateid"].ToString();
string id = dr["brand"].ToString();
string pname = dr["type"].ToString();
string dis = dr["deta"].ToString();
string tim = dr["date"].ToString();
string[] row = { sid, id, pname, dis, tim };
var listViewItem = new ListViewItem(row);
listView1.Items.Add(listViewItem);
}
查看/搜索*
**更新**
try
{
DialogResult x = MessageBox.Show("Do You Really Want To Update This Record", "Cash Book Details", MessageBoxButtons.YesNo);
if (x == DialogResult.Yes)
{
upate.Enabled = true;
delete.Enabled = false;
foreach (ListViewItem item in listView1.SelectedItems)
{
txtid.Text = item.SubItems[0].Text;
txtBrand.Text = item.SubItems[1].Text;
txttyp.Text = item.SubItems[2].Text;
txtdec.Text = item.SubItems[3].Text;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
**更新**
DELETE
DialogResult x = MessageBox.Show("Do You Really Want To Delete This Record", "Item Category", MessageBoxButtons.YesNo);
if (x == DialogResult.Yes)
{
delete.Enabled = true;
int i = dbcon.writer("delete from Ritemcategory where cateid='" + txtid.Text + "'");
if (i == 2 || i == 1)
{
MessageBox.Show("Deleted Succesfully", "Item Category");
view();
generatePid();
}
}
else
{
delete.Enabled = false;
}
DELETE
0
StoredProcedure的
public void generatePid()
{
dr = dbcon.reader("Genarate_itemcategory_id");
while (dr.Read())
{
txtid.Text = dr["value"].ToString();
}
}
//////////////////KEYDOWN////////////
//////////////////
//////////////////KEYPRESS////////////
//////////////////
//////////////////SELECTEDVALUE////////////
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
upate.Enabled = false;
Save.Enabled = false;
delete.Enabled = true;
foreach (ListViewItem item in listView1.SelectedItems)
{
txtid.Text = item.SubItems[0].Text;
txtBrand.Text = item.SubItems[1].Text;
txttyp.Text = item.SubItems[2].Text;
txtdec.Text = item.SubItems[3].Text;
}
}
//////////////////
//////////////////KEYDOWN////////////
if (e.KeyCode == Keys.Enter)
{
insert();
}
//////////////////
public void log()
{
dr = dbcon.reader("select * from Admin where id = ' 1'");
while (dr.Read())
{
string un = dr["fuser"].ToString();
string ped = dr["fpassword"].ToString();
if ((textBox1.Text == "" || textBox1.Text == null) || (textBox2.Text == "" || textBox2.Text == null))
{
MessageBox.Show("Please enter username and password");
}
else
{
if (textBox1.Text == un && textBox2.Text == ped)
{
logdetail();
}
else
{
MessageBox.Show("User Name or Password is incorrect");
}
}
}
}
//////////////////KEYDOWN////////////
//////////////////
相關問題
- 1. 如何連接MySQL Db通過循環
- 2. 如何通過DB連接使用ADO.net
- 3. 通過PHP連接mySQL db
- 4. 通過Perl連接到Teradata
- 5. 通過Intellij IDEA連接到Postgres Heroku DB
- 6. 無法通過js連接到mongo db
- 7. 通過單例類獲取db連接
- 8. 無法通過Spark連接到Mongo DB
- 9. 無法通過Perl連接到SeleniumWebDriver
- 10. 連接到通過PERL MSSQL在FreeBSD *
- 11. 如何通過創建批處理文件來連接PHPMyadmin DB
- 12. 同時通過UNIX連接DB連接錯誤命令
- 13. 如何通過連接列
- 14. 從Microsoft SQL Server 2012可以通過DB LINK連接哪些DB?
- 15. 如何通過Promise重用MongoDB連接
- 16. 如何通過連接Sqlcompact。 OleDbConnection
- 17. 在Perl中使用Perl連接到沒有Sybase Client的Sybase db
- 18. 如何連接到通過CLI
- 19. 如何通過SSL通過PHP連接到Amazon MySQL RDS實例
- 20. 如何使用perl連接到postgresql
- 21. 通過webservice連接
- 22. 連接通過
- 23. DB連接
- 24. Drupal db連接
- 25. 在DB連接
- 26. MySQL db連接
- 27. python db連接
- 28. 如何在DB2中通過DB從Oracle過濾日期鏈接
- 29. 如何保護使用Progress DB通過ODBC連接傳輸的數據
- 30. 如何通過域名連接到服務器上的sql server db
這是應該首先被關閉一個真正的窮人的問題 - 但它仍要求在Perl的解決方案。 – 2016-05-01 16:47:14