Quantcast
Channel: aras PLM community
Viewing all articles
Browse latest Browse all 1103

Populating a form drop down with federated values, please help

$
0
0

Hello,

I am new to innovator development, so am hoping someone can help me out;

Essentially, What I want to accomplish is equal to this;

            System.Data.SqlClient.SqlConnection _conn = null;

               _conn = new System.Data.SqlClient.SqlConnection("connection to another SQL DB");

                _conn.Open();

           

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("SELECT field1, Field2 FROM from table", _conn);

            cmd.CommandType = System.Data.CommandType.Text;

            System.Data.SqlClient.SqlDataReader _rdr = cmd.ExecuteReader();

 

            System.Web.UI.WebControls.DropDownList ddl = (System.Web.UI.WebControls.DropDownList)Page.FindControl("ddlTest");

 

            ddl.DataSource = _rdr;

            ddl.DataTextField = "Field1";

            ddl.DataValueField = "Field2";

            ddl.DataBind();

 

Pull the list values from an external database and populate a list on an Innovator form for selection.

What is the best practise and does anyone have a quick example?

I have been trying to call a server method from a client method.  But I have yet to get it working, here is what I have;

 

//I want to return xml do that I don't have to iterate through the records

strSQL="SELECT Value, label FROM table ITEM order by field1 FOR XML  auto, ELEMENTS";

 

System.Data.SqlClient.SqlConnection _conn = null;

_conn = new System.Data.SqlClient.SqlConnection("connection to another SQL DB");

_conn.Open();

           

System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(strSQL, _conn);

cmd.CommandType = System.Data.CommandType.Text;

System.Data.SqlClient.SqlDataReader _rdr = cmd.ExecuteReader();

 

string result = string.Empty;

 

while (_rdr.Read())

{

                result = _rdr[0].ToString().Replace("<ITEM>"," <ITEM type='list' action='add'>");

}

_conn.Close();

 

Aras.IOM.Item resItem = this.newItem();

resItem.loadAML("<AML>" + result + "</AML>");

return resItem.apply();


Viewing all articles
Browse latest Browse all 1103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>