| Macro to Generate OleDbCommand for a Stored Procedure call |
|
 |
Index ‹ DotNet ‹ ADO
|
- Previous
- 1
- Dotnet >> DTS ErrorI'm working with DTS packages from within C#. Everything works i
development and testing, but when I move the application to
production server (an IIS box without SQL installed on the same box) i
throws:
COM object with CLSID {10020202-EB1C-11CF-AE6E-00AA004A34D5} is eithe
not valid or not registered.
Any ideas what needs to be registered, or is there a way to incorporat
the necessary file with my app so a registration is not required?
Here's the code:
// Execute the DTS on SQL Server to export the data
createAccessDB(strAccessDB, strCreateTableSQL);
string strSQLServerName
ConfigurationSettings.AppSettings["SQLServerName"];
string strSQLConnection
ConfigurationSettings.AppSettings["DBConn"];
string strSQLUserID
ConfigurationSettings.AppSettings["SQLUserID"];
string strSQLPassword
ConfigurationSettings.AppSettings["SQLPassword"];
Microsoft.SqlServer.DTSPkg80.Package2 package = ne
Microsoft.SqlServer.DTSPkg80.Package2Class();
UCOMIConnectionPointContainer CnnctPtCont
(UCOMIConnectionPointContainer) package;
UCOMIConnectionPoint CnnctPt;
PackageEventsSink PES = new PackageEventsSink ();
Guid guid = new Guid("10020605-EB1C-11CF-AE6E-00AA004A34D5"); /
UUID of PackageEvents Interface
CnnctPtCont.FindConnectionPoint(ref guid, out CnnctPt);
int iCookie;
CnnctPt.Advise(PES, out iCookie);
object pVarPersistStgOfHost = null;
package.LoadFromSQLServer(strSQLServerName, strSQLUserID
strSQLPassword
Microsoft.SqlServer.DTSPkg80.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default
null, null, null, strDTSPackageName, ref pVarPersistStgOfHost);
foreach (Microsoft.SqlServer.DTSPkg80.GlobalVariable colGlobalVar
in package.GlobalVariables)
{
if (colGlobalVars.Name=="sServerName" |
colGlobalVars.Name=="sAccessDB" || colGlobalVars.Name=="UserID" |
colGlobalVars.Name=="Password")
{
package.GlobalVariables.Remove(colGlobalVars.Name);
}
}
try
{
package.GlobalVariables.AddGlobalVariable("sServerName"
strSQLServerName);
package.GlobalVariables.AddGlobalVariable("sAccessDB"
strAccessDB);
package.GlobalVariables.AddGlobalVariable("UserID", strSQLUserID);
package.GlobalVariables.AddGlobalVariable("Password"
strSQLPassword);
package.AutoCommitTransaction=true;
package.WriteCompletionStatusToNTEventLog=true;
package.Execute();
package.UnInitialize();
package = null;
}
catch(System.Runtime.InteropServices.COMException ex)
{
...
}
catch(System.Exception ex)
{
...
-
robrichar
-----------------------------------------------------------------------
posted via www.WebFrustration.com
- 2
- Dotnet >> LNK2001 with mixed managed/native dll'sHello,
I'm running into a linking problem when trying to build a dll like so...
step1:
native C++ library & managed c++ = managed c++ dll (this one builds fine)
step 2:
managed c++ dll (the one that built ok) & managed c++ = managed c++ dll
step 2 results in this link error...
error LNK2001: unresolved external symbol "public: bool __thiscall
rw::audio::core::System::IsLocked(void)const "
(?IsLocked@System@core@audio@rw@@$$FQBE_NXZ) SpliceUnity.obj
...among others. The one thing I noticed that is similar between all of
these link errors is that the routines they are refering to are const
methods.. for example...
bool IsLocked() const;
Any methods that are not const link fine. By the way, these routines are in
the native c++ library.
Another strange bit of info, if I use the routine IsLocked in both managed
c++ libraries, the one in step 1 still builds fine, and the link errors show
up when linking step 2. If I comment out all of the references to IsLocked
in the step 2 dll, I still get the link error until I comment out the call to
IsLocked in the step 1 dll. Once they are removed from BOTH managed
libraries, the link error disappears.
I've scowered the web but can't find a resolution to this. I'm wondering if
the const at the end of these methods, or the calls to those routines from
within my managed dll's are causing the two to be mangled differently (maybe
using __clrcall instead of __thiscall).
Any help is greatly appreciated.
Thanks
- 3
- ADO >> Oledb Connection from ASP.Net on Windows 2003 does not workThe following code does not work from an ASP.Net application on Windows
2003 IIS 6 (application isolation mode).
Basically I am trying to connect to a Sharepoint catalog through the
oledb provider for Internet publishing (WebDAV)
It works fine from a windows application on Windows 2003. It works in
ASP.net web application on Windows2000
public void Connect()
{
string connString =
"provider=msdaipp.dso;data source=http://myServer/mycatalog";
OleDbConnection conn = new
OleDbConnection(connString);
try
{
conn.Open();
}
catch
{
throw;
}
finally
{
conn.Close();
}
}
I have also tried the following and none of these works on 2003/IIS6
Changed the website to run in IIS 5 isolation mode
added NT AUTHORITY\NETWORK SERVICE to the administrator group
tried opening the connection in the asp.net in a secondary thread
Impersonated the asp.net web application to run as a user with
administrator privileges
Turned anonymous authentication off and ran the website with integrated
authentication so it takes the logon user credentials
Any help to point me in the right direction would be greatly
appreciated
Thanks
Sriram V
- 4
- Winforms >> Auto Expanding TextBox/ControlsHi there,
I've googled this problem, and not found a suitable solution yet. I was
wondering if anyone has made any progress?
Basically, I want to make a textbox automagically adjust it's height to show
all the text it contains. So, if I add text then it grows, and it shrinks if
I remove text. This is similar to the CanGrow property in MS Access
controls.
I'm willing to purchase a control if anyone knows of any, I'd just like to
get this cracked without spending *too* much time "fiddling" about!
Any help much appreciated
Tobin
- 5
- Visual C#.Net >> webclient timeouti am a newbie, i want to write a code to download data from web using
webclient
string HTMLstring = "";
WebClient client = new WebClient();
Byte[] HP = client.DownloadData("http://www.microsoft.com");
HTMLstring = Encoding.ASCII.GetString(HP);
is it possible to add a timeout timer for this code, e.g. 10s
or i must use another class, like webrequest to doing so?
Thanks for your help!!
- 6
- Visual C#.Net >> Obtain parameter values from methodHow would one obtain the parameter VALUES of a method that has already run?
I can find the method using the StackTrace and StackFrame classes but once I
find the method I would like to obtain the value of one of the parameters
that were passed to the method. Is this possible? Even if I have to use
PInvoke to do so?
I can currently find the parameter TYPEs using reflection but I can not
figure out to obtain the values.
Thanks,
Matt
- 7
- Visual C#.Net >> get file names of filesSay I want to get the file name of C:\temp\something.xml and have that
put into a variable so I can encrypt the file and output it to
c:\temp\filename.enc. I have not found anything that solves this for
me.
I tired this
static void Main(string[] args)
{
string fileName = @("C:\","*.xml");
string path = @"C:\*.xml";
string result;
result = Path.GetFileName(fileName);
but that has to be static. Any help is appreciated.
- 8
- Winforms >> Unknown name of a componentHello Developpers,
I would like to learn the name of a component and where to obtain it to use at my project's forms.
When you open the Task Manager of Windows 2000/XP, etc., you see the CPU Usage History and Memory Usage History on the graphical indicator. This indicator like the osiloscopes's display.
If you know the name of this component, please kindly tell me....
I would like to thank You in advance for your sincere considerations.
Sincerely
- 9
- Visual C#.Net >> Getting the COM IDataObject interface from the DataObject classThe .Net DataObject class implements the COM/OLE IDataObject interface , so
how do I get it.
I have tried this, but it does not work :
// Declare the COM/OLE IDataObject interface
[ComImport, Guid("0000010E-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleDataObject
{
[PreserveSig]
int OleGetData(FORMATETC pFormatetc, [Out] STGMEDIUM pMedium);
[PreserveSig]
int OleGetDataHere(FORMATETC pFormatetc, [In, Out] STGMEDIUM pMedium);
[PreserveSig]
int OleQueryGetData(FORMATETC pFormatetc);
[PreserveSig]
int OleGetCanonicalFormatEtc(FORMATETC pformatectIn, [Out] FORMATETC
pformatetcOut);
[PreserveSig]
int OleSetData(FORMATETC pFormatectIn, STGMEDIUM pmedium, int fRelease);
[return: MarshalAs(UnmanagedType.Interface)]
IEnumFORMATETC OleEnumFormatEtc([In, MarshalAs(UnmanagedType.U4)] int
dwDirection);
[PreserveSig]
int OleDAdvise(FORMATETC pFormatetc, [In, MarshalAs(UnmanagedType.U4)] int
advf, [In, MarshalAs(UnmanagedType.Interface)] object pAdvSink, [Out,
MarshalAs(UnmanagedType.LPArray)] int[] pdwConnection);
[PreserveSig]
int OleDUnadvise([In, MarshalAs(UnmanagedType.U4)] int dwConnection);
[PreserveSig]
int OleEnumDAdvise([Out, MarshalAs(UnmanagedType.LPArray)] object[]
ppenumAdvise);
}
-------------------
DataObject data = new DataObject();
IOleDataObject ido = data as IOleDataObject
--------------
When this is run, ido is null. I have also tried varrious other methods like
using Marshal.GetIUnknownForObject, Marshal.QueryInterface,
Marshal.GetTypedObjectForIUnknown, but none of the approaches work.
What am I doing wrong?
Thanks
Bob
- 10
- Microsoft Project >> Predecessors are not updatingHi!
I'm using project to schedule out a production chart for 64 units of the
same vehicle.
I have a task "Final Paint" which I have needed to move from prior to Item
46"Inspection" to after Item 46"Inspection". I can move the task with no
trouble, but when I try to update its predecessor to be Inspection (which is
now Item 45), The start date for Final Paint doesn't change.
I have tried entering other tasks as the predecessor to try and get this
line to change "eg predecessor 16FS" and still the this item will not follow
on.
Is this a known problem with project 2003, or am I doing something wrong?
Usually I can manually enter "line no"FS without any trouble.
Please help, thanks in advance....
Susie
- 11
- Visual C#.Net >> can't use an array property of a user control in designer?Hi,
I have a user control and I want an array of items to be available to
the user
In my case these items are a class called Needle.
I added a property called Needles to get\set the array (Needle[]) and
it seems to work except that the designer doesn't handle it correctly
In the property page of the designer I see the property and I can
click on it and I get a property window and I can add new Needles.
These are thrown away, they never make it to the cs file and I don't
know why.
The will remain in the design property page until I close VS or
compile.
I have put the code in the Form_Load() to set the array and it works
but the property page does nothing
The code is below, {1} is where I would expect the designer to have
inserted code (similar to {2}) to create the objects.
Anyone have any idea what is wrong?
Vin
/// <summary>
/// Form Code
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private QuickTest.MultiNeedleSlider multiNeedleSlider1;
private void InitializeComponent()
{
//
// multiNeedleSlider1
//
this.multiNeedleSlider1.Location = new System.Drawing.Point(48,
24);
this.multiNeedleSlider1.Name = "multiNeedleSlider1";
this.multiNeedleSlider1.Size = new System.Drawing.Size(312, 72);
this.multiNeedleSlider1.TabIndex = 3;
// {1} would expect the Needles to be new'd here!
}
private void Form1_Load(object sender, System.EventArgs e)
{
// {2} This works perfectly
QuickTest.MultiNeedleSlider.Needle nn = new
QuickTest.MultiNeedleSlider.Needle();
nn.Color = Color.Red;
multiNeedleSlider1.Needles = new
QuickTest.MultiNeedleSlider.Needle[1] {nn};
}
}
//////////////////////////////////////////////////
/// <summary>
/// User Control Code
/// </summary>
public class MultiNeedleSlider : System.Windows.Forms.UserControl
{
private Needle[] m_aNeedles;
public Needle[] Needles
{
get
{
return m_aNeedles;
}
set
{
m_aNeedles = value;
}
}
// begin class Needle
public class Needle
{
private System.Drawing.Color m_colour;
public Needle()
{
m_colour = Color.Black;
}
public System.Drawing.Color Color
{
get
{
return m_colour;
}
set
{
m_colour = value;
}
}
} // end class Needle
}
- 12
- ADO >> Which control to use?Hi
I need a layout like this http://www.infovis.biz/listview.jpg which is an MS
Access list box. Which control in vs2008 allows me to do this? The list is
being filled from an underlying table.
I would appreciate a code example if possible.
Many Thanks
Regards
- 13
- Visual C#.Net >> MdiClientIs there a way to place controls on the surface of MdiClient and have it
always stay in the background when new child forms are loaded into the MDI?
When I place controls on the surface of an MDI app and load child forms, the
controls place on the surface poke through the child form.
In the MDI paradigm, is it not wise/proper to use the MdiClient as a
controls surface?
--
Thanks, John F
- 14
- Visual C#.Net >> Help: Can't use "Not"???I want to set the enabled property of a text box based on if a checkbox is
checked or not. This works....
txtPort.Enabled = ckDefaultPort.Checked;
But, I want the enabled property to be the opposite of the checked value.
Why doesn't this work?
txtPort.Enabled = Not ckDefaultPort.Checked;
It keeps telling my "; expected".
Thanks.
- 15
- ADO >> ERROR: Invalid Object NameHi,
I'm currently trying to retrieve information from a specific table within a
SQL Database using the following code:
Dim oSqlCommand As New SqlClient.SqlCommand
oSqlCommand.CommandType = CommandType.Text
oSqlCommand.Connection = mSqlConnection
oSqlcCommand.CommandText = "SELECT * FROM SOMETABLE"
Dim oSqlReader As SqlClient.SqlDataReader
oSqlReader = oSqlCommand.ExecuteReader
oSqlCommand.Dispose()
Connection to the SQL Database is performed like this :
strConnection = "Driver={SQL Server}" & _
";Server=" & mServerName & _
";Database=" & mDatabaseName & _
";Uid=" & mUserID & _
";Pwd=" & mPassword & ";"
mSqlConnection = New SqlClient.SqlConnection(strConnection)
mSqlConnection.CreateCommand()
While performing the query with the SOMETABLE owner mUserID, there is no
problem accessing the SOMETABLE information.
Therefore, while performing the query with the Database System Administrator
and DB owner mUserID, I'm unable to access the SOMETABLE information getting
the Invalid Object Name 'SOMETABLE' error message.
If I tried to perform the same thing using EXCEL query, the SOMETABLE
information could be accessed by both mUserID which is not the case with my
application.
It seems that only the SOMETABLE owner could access the table. Why the
Database System Administrator and DB owner could not access the SOMETABLE? Am
I doing something wrong while connecting to the Database? Do I have to change
permissions? Why is it working with EXCEL and not with my application?
Thanks
--
Francois Chouinard
|
| Author |
Message |
Dorni50

|
ADO >> Macro to Generate OleDbCommand for a Stored Procedure call
After searching for just such a macro/tool, I decided to write one
myself. After writing one myself, I decided to post it for others who
might be searching as I was:
Here's the macro. Since clipboard access is not available in Visual
Studio Macros, it's based off the current selection. What I do is
select my stored procedure code in Visual Studio and run this macro.
The output is put into the Output window pane, and I copy and paste it
from there. It's already saved me hours and I only wrote it
yesterday.
Sky's the limit on customizing this thing. Just please let the world
know if you make some sort of massive improvement. It's just a Macro,
so make all the changes you want to suite your coding style, etc.
By default, if uses a connection object named "conn" and it calls
"ExecuteNonQuery". Also, as you can see, it converts the T-SQL types
that I had immediate need for to OleDbDataTypes. Add as needed. Go
to town!
(I hope word-wrappnig doesn't mess this all up...)
'-----------------------------------------------------------
' Select the entire stored procedure code and run this
Sub CraeteOleDbCommandFromSp()
Dim Win As OutputWindowPane = GetActivePane()
Dim StoredProcedure As String = DTE.ActiveDocument.Selection.Text
Dim RegExProcedure As Regex = New
Regex("procedure\s+(?<Name>[A-Za-z0-9_]+)\s+(?<Parameters>[/@A-Za-z\s/(/)0-9,]+?)[^A-Za-z0-9_]as[^A-Za-z0-9_]")
Dim M As Match = RegExProcedure.Match(StoredProcedure)
Dim spName As String = M.Groups("Name").Value
Dim spParameters As String = M.Groups("Parameters").Value
Win.Clear()
Dim RegExParameters As Regex = New
Regex("@(?<Name>[A-Za-z_0-9]+)\s+(?<Type>[A-Za-z0-9]+)\s*\(?(?<Length>[0-9]*)\)?\s*(?<Output>output|OUTPUT)?")
Dim MC As MatchCollection = RegExParameters.Matches(spParameters)
Win.OutputString("#region " & spName & " call generated by
CreateOleDbCommandFromSp macro" & vbCrLf)
Win.OutputString("OleDbCommand sp = new OleDbCommand();" & vbCrLf)
Win.OutputString("sp.Connection = conn;" & vbCrLf)
Win.OutputString("sp.CommandText = ""{? = CALL " & spName & "(")
Dim ParameterCount As Integer = MC.Count()
For Each M In MC
ParameterCount = ParameterCount - 1
If ParameterCount = 0 Then
Win.OutputString("?")
Else
Win.OutputString("?,")
End If
Next
Win.OutputString(")}"";" & vbCrLf)
Win.OutputString("sp.Parameters.Add(""@RetVal"",OleDbType.Integer);"
& vbCrLf)
Win.OutputString("sp.Parameters[""@RetVal""].Direction =
ParameterDirection.Output;" & vbCrLf)
For Each M In MC
Dim OleDbDataType As String = M.Groups("Type").Value
Select Case OleDbDataType.ToUpper()
Case "BIGINT"
OleDbDataType = "BigInt"
Case "INT"
OleDbDataType = "Integer"
Case "VARCHAR"
OleDbDataType = "VarChar"
Case "SMALLINT"
OleDbDataType = "Smallint"
Case "TINYINT"
OleDbDataType = "TinyInt"
Case "UNIQUEIDENTIFIER"
OleDbDataType = "Guid"
Case Else
OleDbDataType = M.Groups("Type").Value
End Select
Win.OutputString("sp.Parameters.Add(""@" &
M.Groups("Name").Value & """,OleDbType." & OleDbDataType)
If Not M.Groups("Length").Value = "" Then
Win.OutputString("," & M.Groups("Length").Value)
End If
Win.OutputString(");" & vbCrLf)
Next
For Each M In MC
If Not M.Groups("Output").Value = "" Then
Win.OutputString("sp.Parameters[""@" &
M.Groups("Name").Value & """].Direction = ParameterDirection.Output;"
& vbCrLf)
Else
Win.OutputString("sp.Parameters[""@" &
M.Groups("Name").Value & """].Value = " & M.Groups("Name").Value & ";"
& vbCrLf)
End If
Next
Win.OutputString("sp.Connection.Open();" & vbCrLf & "try" & vbCrLf
& "{" & vbCrLf)
Win.OutputString(vbTab & "sp.ExecuteNonQuery();" & vbCrLf)
Win.OutputString(vbTab & "if(
Convert.ToInt32(sp.Parameters[""@RetVal""].Value) != 0 )" & vbCrLf)
Win.OutputString(vbTab & vbTab & "throw new
ApplicationException(String.Format(""Execute of " & spName & " failed
with {0}"",Convert.ToInt32(sp.Parameters[""@RetVal""].Value)));" &
vbCrLf)
Win.OutputString("}" & vbCrLf & "finally" & vbCrLf & "{" & vbCrLf
& vbTab & "sp.Connection.Close();" & vbCrLf & "}" & vbCrLf)
Win.OutputString("#endregion" & vbCrLf)
End Sub
Function GetOutputWindow() As OutputWindow
Return DTE.Windows.Item(Constants.vsWindowKindOutput).Object()
End Function
Function GetActivePane() As OutputWindowPane
Return GetOutputWindow.ActivePane
End Function
DotNet419
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ ADO |
- Next
- 1
- 2
- ADO >> How do I detect a DBNull in a strongly typed DataSet?Although I am able to set a DateTime column to null, it throws an error when
I attempt to test for null... example
Column set to null as follows:
private void InitializePriorsPostedThruTest()
{
object[] key = {cbAgencyID.Value.ToString()};
TwsDS.twsAgencyRow r = (TwsDS.twsAgencyRow)
twsDS1.twsAgency.Rows.Find(key);
r.SetPriorsPostedThruNull();
}
And test for it here (Will ultimately be checking for dates that have been
set):
private void cbAgencyID_RowSelected(object sender,
Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e)
{
object[] key = {cbAgencyID.Value.ToString()};
TwsDS.twsAgencyRow r = (TwsDS.twsAgencyRow)
twsDS1.twsAgency.Rows.Find(key);
if (r.PriorsPostedThru.Value == DBNull.Value)
MessageBox.Show("Null detected");
}
- 3
- Winforms >> Tab key in a datagrid on a modeless dialogHello
I have a datagrid on a modeless dialog and when the focus is on the datagrid
the tab key doesnt work. Now, I understand that when you have a modeless
dialog then there is some kind of message loop missing and that is why the
tab key doesnt get captured. That is why I though I could inherit my own
datagrid and override the ProcessKeyPreview to capture the Tab key. This
only works with the Enter key though. The Tab key never gets sent to the
DataGrid. Does anyone know where the tab goes? Do I have to use the textbox
column in some way to get hold of this one. I also wonder why the Enter key
is seen by the datagrid but not the Tab key.
Thanks for any input
/Peter
- 4
- Net Framework >> Debugging a server appHi,
I am having the following event logged when I try to debug a COM+ server
application:
"The server {54AD3709-9B43-42A8-B896-404FDCF4AC85} did not register with
DCOM within the required timeout"
I also get a dialog box saying "An error ocurre while processing the last
operation. Error code 8008005 - Server execution failed. The event log may
contain additional troubleshooting information".
And all I am doing is:
I go to the Component Services Explorer and I Start the COM+ application.
This opens an instance of VS.NET 2003 containing dllhost.exe.
My intention is to be able to debug the components in that COM+ server app.
--
Thanks in advance,
Juan Dent, M.Sc.
- 5
- Dotnet >> Strange, intermittent "Configuration Error" involving a COM DLLI have a Dot Net project that references a COM DLL called
"Crypto.dll," which is registered on my machine. I added the reference
via the "Add Reference" dialog in Visual Studio Dot Net, and I am
successfully accessing methods in this DLL in some of my classes.
"Interop.CRYPTOLib" is the name of the interop VS.NET created for me
when I added the reference.
Frequently, when I try to run my application, I get the error that
follows.
What's very frustrating and puzzling is that sometimes this error
occurs and sometimes it doesn't; it will occur 10 times in a row, then
I'll walk away from my desk for 15 minutes, and the application will
run fine.
Rebootimg my machine always seems to fix the error, but only for a
short period of time; it always recurs eventually.
Any help that anyone could give me on this would be greatly
appreciated...I'm really stumped! Thanks in advance!!
--JB
---------------------------------------------------------
HERE IS THE ERROR:
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: Access is denied: 'Interop.CRYPTOLib'.
Source Error:
Line 196: <add assembly="System.EnterpriseServices,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
Line 197: <add assembly="System.Web.Mobile, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 198: <add assembly="*"/>
Line 199: </assemblies>
Line 200: </compilation>
Source File: c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config
Line: 198
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'Interop.CRYPTOLib' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = Interop.CRYPTOLib
(Partial)
LOG: Appbase = file:///C:/Inetpub/wwwroot
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Interop.CRYPTOLib
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/root/8073f566/7100ac34/Interop.CRYPTOLib.DLL.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/root/8073f566/7100ac34/Interop.CRYPTOLib/Interop.CRYPTOLib.DLL.
LOG: Attempting download of new URL
file:///C:/Inetpub/wwwroot/bin/Interop.CRYPTOLib.DLL.
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Interop.CRYPTOLib, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET Version:1.1.4322.573
- 6
- Visual C#.Net >> No parameterless constructor defined for this object**************************************
//Load the Assembly
Assembly a = Assembly.LoadFrom(sAssembly);
//Get Types so we can Identify the Interface.
Type[] mytypes = a.GetTypes();
BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public |
BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
//Iterate through the Assembly to find Class with a Public Interface.
//****Each Assembly should only have one Public Entry Point****
//****using this method to expose that method and pass the XML data to it****
foreach (Type t in mytypes)
{
MethodInfo[] mi = t.GetMethods(flags);
Object obj = Activator.CreateInstance(t);
**************************************
I am trying to dynamically call an assembly. The Assembly name is being
pulled from a SharePoint List and in this case it is called TransformXML. I
am getting the following error when it gets to the Activator...
ERROR:
**********************************************************
*An unhandled exception of type 'System.MissingMethodException' occurred in
* *mscorlib.dll
*
*
*
*Additional information: No parameterless constructor defined for this
object *
**********************************************************
I am also including the code from the class being called.
Transform.dll
**************************************************
public class CreateTransform
{
#region Public Methods
public CreateTransform()
{
}
public CreateTransform(string sXML, Microsoft.SharePoint.SPListItem
_spListItem)
{
//System.Xml.XmlDocument xmlDoc;
Microsoft.SharePoint.SPAttachmentCollection spAttachColl =
this.GetXSLTransform(_spListItem);
this.TransformXML(sXML,spAttachColl);
}
#endregion
- 7
- Visual C#.Net >> custom logging sink for logging application blockI have written a custom logging sink for the enterprise library logging
application block (June 2005). I have been able to configure it as expected
from the UI config tool (EntLibConfig.exe).
I have built a console application to test it with and I am getting the
following error message write to the default trace log when I attempt to use
my custom logging sink.
'An error occurred while the Distributor was processing the message. Please
check your configuration files for errors or typos. Verify that your sinks
are reachable (queues exist, permissions are set, database exists, etc...)'
This might be security related can anyone give me the answer on how to fix
this?
I can see from VS that the module for my custom logging sink is loaded at
runtime but I am unable to break into the assembly which indicates to me
that any of the 'LogSink' overridden methods are not being called.
Cheers
Ollie Riches
- 8
- Visual C#.Net >> trouble witch using struct from C dllHello, I'm a "expert of beginner" in C#.
I have a dll - in C. And in this dll is this struct:
typedef
struct msg_s { /* please make duplicates of strings before next call
to emi_read() ! */
int op_type; /* of "op_t" type: operation type; submit (>0), response
(<0) */
union {
struct {
const char* from;
const char* to;
const char* notif_addr;
int notif_type; /* not_t */
const char* validity; /* DDMMYYHHmm */
const char* timestamp; /* DDMMYYHHmmss */
dst_t deliv_status;
int deliv_reasoncode;
const char* deliv_timestamp; /* DDMMYYHHmmss */
const char* text;
int priority;
int bit8; /* data coding scheme */
int numbits; /* number of bits in TD (text) if bit8=1 */
int msg_class;
int rpid; /* rpid == -1 => use RPID value "0000" */
/* rpid == 0 => do not use RPID value */
const char* xservices; /* extra services */
} submit;
struct {
int ack;
int errcode;
const char* sysmsg;
} response;
} uu;
} msg_t;
How can I use this struct in C#?
How can I make in C# the same code as is in C:
msg_t* msg = 0;
msg = emi_msg( emi); //emi_msg is a function whitch return a pointer
optyp = msg->op_type;
Thanks a lot
Pavel Spaleny
- 9
- 10
- Visual C#.Net >> OOD QuestionThis is a design / inheritance qus.
I have class Task.
This is a base class for some specific tasks
Say
WorkOrderTask : Task
TimeSheetTask : Task
Now Task has a function GetDetails() which gets all info about task. This
makes a database call.
I override this in the derived class. For implementing this in derived
class i see following 2 approaches.
Approach 1. WorkOrderTask .GetDetails()
{
Calls base.GetDetails(); to get base details, populates in the
object
Gets details specific to WorkOrderTask, populates in the object
returns;
}
Approach 2. WorkOrderTask .GetDetails()
{
Get details specific to WorkOrderTask as well as the base class
details, populates in the object
returns;
}
The problem with
Approach 1
I have to make 2 database calls.
Approach 2
If theres some change in base class I need to take care of these in all the
derived classes as well.
Whereas, Approach 1 is advantageous here as by modifying only the
Task.GetDetails funciton ( this is the base class ) function i have all the
values and i do not need to touch the derived classes.
Was thinking this might be a very common problem, so perhaps many of might
be able to guide me on the approach i must take here. Perhaps anything other
then the two i have talked about.
Thanks in advance
Sourabh
- 11
- Visual C#.Net >> OO AnalysisAlright, I've read Jesse Liberty's book almost cover to cover. So now I
know something about using C#. I have an idea for a program I want to
write.
I have NO IDEA what objects I need, or how to set things up. Are there
any good object-oriented books or website tutorials on ANALYSIS that you
would recommend? I need something that will teach me to diagram and
organize my thoughts.
The program I want to write transfers certain files and directories from
one PC to another. It seems I need a source computer object and a
destination computer object. Beyond that, to what level should I
extrapolate objects? Should I have a log object, for instance? Surely,
I wouldn't have an object for each program I want to copy (I was
thinking of doing an enumeration for software). I need to know where to
draw the lines.
-KV
- 12
- Winforms >> A Newbie QuestionHi All,
I'm trying to develop a prototype for a small Room Booking application. This
is a 3 tier application. The presentation layer consists of Windows Forms.
There will be multiple concurrent clients. The application needs transaction
supportivity.I thought of developing in .NET C#. The data base is going to
be SQL Server 2000.
I thought of following the design guidelines mentioned in the
MSDN,Application Architecture for .NET Designing Applications and Services
from Microsoft
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html
/distapp.asp).
I have some questions. For my distributed application which technology would
be best suitable?. Enterprise Services COM+ components or .NET remoting or
Web Services? How can I take the decision? My application needs quick
response (Speed is important).
Thanks in advance.
Regards,
Risath
- 13
- Visual C#.Net >> Create a string of n pixel width...Since I have no control over a treeview's scroll bars (i'm drawing icons
and text to the right of the treenodes) I've decided to just add some
special text to the end of my tree node text which I will then strip out
when it comes to drawing the treenode into the treeview...
Anyway I know there is a way to get the pixel length of a string that
already exists, but is there a good way to create a string of characters
that are a certain length? Should I just have a function that loops
adding 'x' until it's a certain length? Since this will only be run
when a node is created or when a node's special properties change I'm
just planning on doing this - unless any of you know of a better solution.
Thanks,
Benny
- 14
- ADO >> Batch Update ProblemHi,
I am porting an ADO.NET 1.1 project to version 2.0 and trying to take
advantage of the dataAdapter's UpdateBatchSize property. When I set this to
0 and change my updatedRowSource to either NONE or OUTPUT PARAMS, I get the
following error when trying to update more than one row.
5/10/2006 12:52:18 - Exception occurred ---> Description:
ExceptionHandling.CustomException: The ConnectionString property has not been
initialized. ---> System.InvalidOperationException: The ConnectionString
property has not been initialized.
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable
dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
My update method is as follows. I initialize the data adapter's update
related sql command objects' connections at run-time. (I am not using
'USING' as I want to catch exceptions)
Private Sub DoUpdate()
Dim cn As New SqlConnection(strConn)
Me.dataAdapter1UpdateCommand.Connection = cn
Me.dataAdapter1DeleteCommand.Connection = cn
Me.dataAdapter1InsertCommand.Connection = cn
Try
Me.dataAdapter1.Update(Me.Ds.dtMyTable)
Catch ex As Exception
LogExceptions(Me.Name, "DoUpdate", ex)
MessageBox.Show(strChgError, strSrvrError, MessageBoxButtons.OK,
MessageBoxIcon.Error)
Finally
cn.Dispose()
End Try
End Sub
Can anyone tell me why this happens and how to fix it. I can correct the
problem by setting the updateBatchSize to 1, and the problem does not occur
when only one row is being updated. I am connecting to SQL Server 2000 SP4.
Thanks.
--
John
- 15
|
|
|