We have a customer database that I would like to be able to pull information from in order to display realtime reports in a sharepoint web part.
I'm writing the web part in VB.Net 2003, and I HATE FrontPage (plus we don't want to use it because of the ghosting issue)
I've tried several different ways of getting it, but so far no luck.
Protected Overrides Sub RenderWebPart(ByVal output As System.Web.UI.HtmlTextWriter)
Dim DS As System.Data.DataSet
Dim Con As System.Data.SqlClient.SqlConnection
Dim Ada As System.Data.SqlClient.SqlDataAdapter
Dim conStr As String
conStr = "server=poweredge1850;uid=****;pwd=****;initial catalog=jl"
Con = New System.Data.SqlClient.SqlConnection(conStr)
Ada = New System.Data.SqlClient.SqlDataAdapter("select * from tblCustomer Where CustomerID=41614", Con)
DS = New System.Data.DataSet
Try
Ada.Fill(DS, "Table1")
Catch ex As Exception
output.Write(ex)
End Try
End Sub
Returns:
System.Security.SecurityException: Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken) at System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride) at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) at System.Security.CodeAccessPermission.Demand() at System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString constr) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at DatabaseConnect_WebPart.DBConnect.RenderWebPart(HtmlTextWriter output)
And
Dim test As New ADODB.Recordset
crashes it completely without even returning the error message. (Error: "The "DBConnect" Web Part appears to be causing a problem")
Is there a way to pull out the information I want without having to resort to the seeping evil that is front page??
I'm writing the web part in VB.Net 2003, and I HATE FrontPage (plus we don't want to use it because of the ghosting issue)
I've tried several different ways of getting it, but so far no luck.
Protected Overrides Sub RenderWebPart(ByVal output As System.Web.UI.HtmlTextWriter)
Dim DS As System.Data.DataSet
Dim Con As System.Data.SqlClient.SqlConnection
Dim Ada As System.Data.SqlClient.SqlDataAdapter
Dim conStr As String
conStr = "server=poweredge1850;uid=****;pwd=****;initial catalog=jl"
Con = New System.Data.SqlClient.SqlConnection(conStr)
Ada = New System.Data.SqlClient.SqlDataAdapter("select * from tblCustomer Where CustomerID=41614", Con)
DS = New System.Data.DataSet
Try
Ada.Fill(DS, "Table1")
Catch ex As Exception
output.Write(ex)
End Try
End Sub
Returns:
System.Security.SecurityException: Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken) at System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride) at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) at System.Security.CodeAccessPermission.Demand() at System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString constr) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at DatabaseConnect_WebPart.DBConnect.RenderWebPart(HtmlTextWriter output)
And
Dim test As New ADODB.Recordset
crashes it completely without even returning the error message. (Error: "The "DBConnect" Web Part appears to be causing a problem")
Is there a way to pull out the information I want without having to resort to the seeping evil that is front page??