Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Not able to fetech data using custom assembly

Author  Topic 

misterraj
Yak Posting Veteran

94 Posts

Posted - 2006-09-26 : 08:16:35
I have create a custom assembly and using in one of my report.The preview of the report is coming correctly .But fails when the report get deployed on the server.
The report is showing the data using assembly that is coming from the sql server but fails to get the data from oracle.
Below is the code that i have written in the custom assembly.

public string GetData()
{
string testStr="";
SqlClientPermission permission = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
permission.Assert();
string connectString="Data Source=ssrehal;Initial Catalog=CHECKDB;User Id=sa;Password=sa;";
SqlConnection sCon=new SqlConnection(connectString);
sCon.Open();
SqlCommand sCmd=new SqlCommand("select * from tb_test",sCon);
SqlDataReader sRead=sCmd.ExecuteReader();
while (sRead.Read())
{
testStr=testStr+ sRead["Name"].ToString();
}
sCon.Close();
return testStr;
}

public string GetPartDesc(string strPart)
{
string tempStr="";
OleDbPermission permOledb=new OleDbPermission(System.Security.Permissions.PermissionState.Unrestricted);
permOledb.Assert();
string connectionStrOracle="Provider=msdaora;Data Source=mbenz_dev12;User Id=CSICTLOWNER_1500_REL;Password=cincom;";
string strOracle;
strOracle="SELECT PART_DESC FROM PART WHERE PART_NBR='" + strPart + "'";
OleDbConnection oConn=new OleDbConnection(connectionStrOracle);
oConn.Open();
OleDbCommand oCmd=new OleDbCommand(strOracle,oConn);
OleDbDataReader oRead=oCmd.ExecuteReader();
while(oRead.Read())
{
tempStr=oRead["PART_DESC"].ToString();
}
oConn.Close();
return tempStr;
}
Help me please .

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-26 : 08:36:54
Which error messages are yuo getting?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -