如何通过perl连接infobright DB?

发布于 2024-10-30 08:41:23 字数 31 浏览 5 评论 0原文

如何通过perl连接infobright DB?

How to connect infobright DB through perl ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

染柒℉ 2024-11-06 08:41:23

使用 DBD-mysql。使用或类似的方式安装它

perl Makefile.PL --mysql_config=/usr/local/infobright-3.5.2-x86_64/bin/mysql_config

With DBD-mysql. Install it with

perl Makefile.PL --mysql_config=/usr/local/infobright-3.5.2-x86_64/bin/mysql_config

or similar.

苏佲洛 2024-11-06 08:41:23

您可以使用与 MySQL 一起使用的任何标准数据库连接来连接到 Infobright。 Daxim 是正确的——DBD 是连接数据库的最常见方法之一。在 DBD 配置中,您所需要做的就是将端口号从 3306 (MySQL) 更改为 5029 (Infobright)。其余的都一样。

You can connect to Infobright using any standard database connection that you'd use with MySQL. Daxim is correct -- DBD is one of the most common ways to connect to the database. In your DBD config, all you'd need to do is change the port number from 3306 (MysQL) to 5029 (Infobright). All the rest is the same.

权谋诡计 2024-11-06 08:41:23

**插入 **

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

    }

**插入 **

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

        }

**更新 **

删除

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;

        }

<删除

**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");

VIEW/SEARCH

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

        }

VIEW/SEARCH*

**UPDATE **

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

        }

**UPDATE **

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

呢古 2024-11-06 08:41:23

存储过程

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////////////




//////////////////

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////////////




//////////////////
烟火散人牵绊 2024-11-06 08:41:23
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;
    }

}

//////////////////////////////////////////////
第二次
////////////////////////////////////

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

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

     }
   }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文