i am trying to connect to an informix database in my web application and retrieve the data based on an item code entered by the user and store it in a datatable later i want to take the data from the datatable and display it on my textboxes for the item selected. its an odbc connection DRIVER={IBM INFORMIX ODBC DRIVER} in my connection string
if (DropDownList4.Text == "***.**.**.**" || DropDownList4.Text == "***.**.**.**" || DropDownList4.Text == "***.**.**.**")
{
//string abilene = ConfigurationManager.ConnectionStrings["Abeliene"].ConnectionString.ToString();
IfxConnection conn = new IfxConnection("User Id=****;Password=****;" +"Host=abkrisc1;Server=abkrisc1;" +"Service=1719;DB=circa119;");
DataTable Abilene = new DataTable();
Abilene.Columns.Add("item");
Abilene.Columns.Add("desc");
Abilene.Columns.Add("upc");
Abilene.Columns.Add("itemupc");
Abilene.Columns.Add("ctyp");
Abilene.Columns.Add("citg");
Abilene.Columns.Add("best");
Abilene.Columns.Add("disp");
Abilene.Columns.Add("mold");
Abilene.Columns.Add("csel");
IfxCommand cmd;
cmd = new IfxCommand("Select t_item,t_idsc,t_upct,t_item_upc,t_ctyp,t_citg,t_best,t_disp,t_mold,t_csel from tsckcm907 where t_item = @item'");
conn.Open();
cmd.Parameters.Add("@item", IfxType.VarChar).Value = TxtItem.Text;
try
{
IfxDataReader myreader = cmd.ExecuteReader();
Abilene.Load(myreader);
Response.Write(Abilene.Columns);
con = true;
}
catch (Exception ex)
{
throw ex;
con = false;
}
if (con == true)
{
while (Abilene.Rows.Count > 0)
{
TxtItem.Text = Abilene.Rows[0]["item"].ToString();
lbldesc.Text = Abilene.Rows[1]["desc"].ToString();
}
}
The error i get when i debugged was at conn.open() -> ERROR [HY000] [Informix .NET provider][Informix]Server abkrisc1 is not listed as a dbserver name in sqlhosts.
i have done a similar scenario with sql database, but informix i have never worked with. Please if anyone could help me with this code that would be awesome, even this code that i used was found from ibm website.