|
Hi all,
Just a quick query in relation to dependent assemblies, specifically AxInterop.SHDocVw.dll and Interop.SHDocVw.dll as required for this project: http://www.codeproject.com/cs/miscctrl/WebBrowserEx.asp
I'm developing a small piece of software for a local client that requires the MS Web Browser ActiveX control embedded within a particular form. As these DLLs are OS dependent, I'm concerned that my compiled C# program will not work correctly on their machines. The way I see it, I have to provide these two DLLs, otherwise the software generates an "Assembly not found" exception. But if I provide them, they are suited to my OS only.
If the client upgrades their OS without telling me, or a servicepack is automatically deployed, or their version of .NET is upgraded, could this break my software?
If so, what is the best way of getting around this, or at least mitigating the problem to some degree? It's not possible to compile the program on each and every one of his machines, and i only want to distribute the binaries.
Any thoughts would be much appreciated.
Regards,
Ritchie
andrewpritchie(at)gmail.com
|
|
|
|
|
Whats wrong with this picture? I keep getting this error and I"m sure it's because of the image I'm trying to pull out. Never was good are arrays....
public class PictureData
{
public int ID;
public String name;
public byte[] data;
public String contenttype;
}
public PictureData GetPrictureDetails(int ID)
{
SqlConnection myConnection = new SqlConnection(SqlHelper.ConnectionString);
SqlCommand myCommand = new SqlCommand("GetPictures", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
SqlParameter parameterID = new SqlParameter("@ID", SqlDbType.Int, 4);
parameterID.Value = ID;
myCommand.Parameters.Add(parameterID);
SqlParameter parametername = new SqlParameter("@name", SqlDbType.VarChar, 50);
parametername.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(parametername);
SqlParameter parameterdata = new SqlParameter("@data", SqlDbType.Image, 16);
parameterdata.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(parameterdata);
SqlParameter parametercontenttype = new SqlParameter("@contenttype", SqlDbType.VarChar, 50);
parametercontenttype.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(parametercontenttype);
myConnection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();
PictureData myPictureData = new PictureData();
myPictureData.ID = (int)parameterID.Value;
myPictureData.name = (string)parametername.Value;
myPictureData.data= (byte[])parameterdata.Value;
myPictureData.contenttype = (string) parametercontenttype.Value;
return myPictureData;
}
so so lost lol
|
|
|
|
|
Judy101101 wrote: I keep getting this error
What error are you getting ? In those code, or when you try to turn the byte[] into an actual image ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
yes thats the idea I'm using the:
Response.BinaryWrite (myPictureData.data);
|
|
|
|
|
Having written the content type also ? What error are you getting ? Have you tried this code to load an image in a WinForms app, into a Bitmap and display it ? Then you can be sure that the Bitmap is coming out OK without worrying about sending data to a browser.
Bitmap.FromStream is what you want, passing the bytes in via a stream.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have never pulled an image out of a database. I don't know what a winforms app is? can I use that in C# webform? It's all new to me.
|
|
|
|
|
OK
A winforms app is an app in .NET that makes a windows application instead of a web one. If that's hard for you right now, then perhaps it's an unnecessary diversion. You could perhaps try something like this:
System.IO.MemoryStream ms = new System.IO.MemoryStream(picture.Data);
System.Drawing.Bitmap bmp = System.Drawing.Bitmap.FromStream(ms) as Bitmap;
bmp.Save(@"c:\test.jpg");
which, assuming your data is meant to be a jpg, should save it to disc. If it does, then your class is reading the image fine. picture.Data is meant to be whatever your class instance is, and it's property for the byte[].
At this point I still have no idea what your trouble is. You started by saying you get an error, and you've still not told me what it is.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ok my reply was dumb, haven't used windows applications at all. lol did I mention I was blond? I think I have to do the Response.BinaryWrite thing. the error I get is
System.Data.SqlClient.SqlException: A severe error occurred on the current command. The results, if any, should be discarded.
|
|
|
|
|
OK - at that level it looks like your code is not getting to the point of pulling the data from the database. Do you know what line is causing the error ? Do you know how to set breakpoints and step through your code ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
this is my code in pageload:
int ID = 1;
picDB myPic = new picDB();
picDB.PictureData myPictureData = myPic.GetPrictureDetails(ID);
Response.ContentType = myPictureData.contenttype;
Response.BinaryWrite (myPictureData.data);
I get this one error :
General network error. Check your network documentation. that one comes and goes with this same problem. read up on it and it's just a strange thing and stops at my
myCommand.ExecuteNonQuery();
the other error happens at the same point:
A severe error occurred on the current command. The results, if any, should be discarded.
|
|
|
|
|
Judy101101 wrote: GetPrictureDetails
You know there's a typo here, right ?
Judy101101 wrote: myCommand.ExecuteNonQuery();
It looks to me like your problem is connecting to the database.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
here is my stored procedure, I don't think there is anything wrong with it, but never worked with images before
CREATE PROCEDURE GetPictures
@ID int,
@name varchar OUTPUT,
@data image OUTPUT,
@contenttype varchar OUTPUT
AS
SELECT
img_name = @name ,
img_data = @data,
img_contenttype = @contenttype
FROM Image
WHERE
img_pk = @ID
GO
|
|
|
|
|
Here[^] is an article on saving/loading images in SQL Server and C#.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi...
Close the database connection after you fill myPictureData...
<br />
myConnection.Open();<br />
myCommand.ExecuteNonQuery();<br />
<br />
PictureData myPictureData = new PictureData();<br />
<br />
myPictureData.ID = (int)parameterID.Value;<br />
myPictureData.name = (string)parametername.Value;<br />
myPictureData.data= (byte[])parameterdata.Value;<br />
myPictureData.contenttype = (string) parametercontenttype.Value;<br />
<br />
myConnection.Close();<br />
<br />
return myPictureData;
Free your mind...
|
|
|
|
|
Exactly what error are you getting? Nothing in your code is jumping out at me. The only thing I see that looks like a problem is that your accessing the parameter values after you have closed the connection.
|
|
|
|
|
Hello,
I have an issue as I am trying to use remoting in my VS 2005 project, with Ipc channels.
I have the assembly myproject.dll, containing all the necessary implementation for server and client processes to use it for remoting:
IMyObject
CMyObject : IMyObject
CMyObjectRemoteClient : IMyObject
CMyObjectRemoteServer : MarshalByRefObject, IMyObject
I have a first process, the server, instantiating CMyObjectRemoteServer, registring the channel, etc. All goes well for that part:
// Create Ipc Channel
m_oIpcServerChannel = new IpcServerChannel("myproject");
// Register to the IPC channel
ChannelServices.RegisterChannel(m_oIpcServerChannel, false);
//register remote object
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(CMyObjectRemoteServer),
"CMyObject",
WellKnownObjectMode.Singleton);
I have the second process, the client, doing the following:
// Create Ipc Channel
m_oIpcClientChannel = new IpcClientChannel("myproject", null);
// Register to the IPC channel
ChannelServices.RegisterChannel(m_oIpcClientChannel, false);
// Get the remote object
remoteObject = (IMyObject) Activator.GetObject(
typeof(CMyObjectRemoteServer),
"ipc://myproject/CMyObject");
So far, all is good. No exception. But then I try to call a function of my object:
remoteObject.Open();
And I get the following exception:
1724 RemoteTester. WARNING 18:49:57:246 00e9c MyNamespace::CMyObjectRemoteClient.Open() Error calling remote object function: Could not load file or assembly 'myproject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
The first process is nothing but an exe using myproject.dll to get a CMyObjectRemoteServer object. It works good.
The second process is also a simple exe using myproject.dll to get a CMyObjectRemoteClient object.
The 2 exe of the client and server, and myproject.dll are all in the same folder. I also checked:
typeof(CMyObjectRemoteServer).Assembly.CodeBase
typeof(CMyObjectRemoteClient).Assembly.CodeBase
to find out they really point to the right place, and all looks fine.
It works good until it fails to locate the assembly 'myproject', where it actually got CMyObjectRemoteClient, which also contains CMyObjectRemoteServer object from (if this is what it looking for). Duh! What is going wrong, and why does it fail loading the assembly?
Thanks for your help!
-Sly
There are 3 types of people in this world, people who understand binary, and those who don't.
-- modified at 19:06 Thursday 24th November, 2005
|
|
|
|
|
Hi
I'm in the process of setting up the security module for a new c# windows application.
Basically I import employee data (last name, first name) from an existing HR system. The employee needs to be assigned a UserName to allow them to login to the new application. UserNames are assigned to various groups which enable or disable different buttons etc.
I know this seems pretty standard, but I require this in c# and I can't find an example to get me started.
I think ideally it should work like the windows local user/group security or SQL server login/user/role security.
If I used SQL server as the backend database would it be better to integrate my c# application with sql server security? Again, I can't find any code or project samples.
Many thanks
J
|
|
|
|
|
Hi,
I want to draw a line on a WinForm.
Assume that the line drawn will have the following coordinates:
(0, 0, 100, numericUpDown value)
I want the numericUpDown value to be tied to a Button.
When the button is clicked the line is drawn on the form.
Thanks in advance.....
|
|
|
|
|
Drawing has to happen in your paint handler, so your paint handler should know if it has to draw the line, and if so, get it's values from member variables. Your button handler should update those values and call Invalidate();
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can anyone help me? I`ve just started my adventure with .NET.
I want use regular expression in my text box to validate text. For example reg. expression like this : "[0-9][0-9]-[0-9][0-9][0-9]" accepts only for example "43-456" text. What if I enter "54-8f5" ? .NET Regular Expressions tells me that this text is not correct. But it doesn`t tell me which character is invalid.
My problem is that I want .NET Regular Expressions show me which character (which character index in this incorrect string) is invalid.
Can anyone help with this?
conrados
|
|
|
|
|
|
Hello all,
i am using Datagrid to dispay row directly from my database but i need to click on one row to open details for this row from another table in the database where i can hang the value for the row with specifc row like in the combobox ValueMember
Thanks for help
Hoho
|
|
|
|
|
DataRowView currentRowInTheGrid = (DataRowView)this.dataGrid1.BindingManager[this.dataGrid1.DataSource, this.dataGrid1.DataMember].Current;
I hope you understand...because is a rough world out there...
|
|
|
|
|
Thanks so much about your help
but i need to know the ID of this current record to select the related details with this ID.
thank
hoho
|
|
|
|
|
Having the dataRowView you can obtain the coresponding dataRow :
DataRowView currentRowInTheGrid = (DataRowView)this.dataGrid1.BindingManager[this.dataGrid1.DataSource, this.dataGrid1.DataMember].Current;
DataRow currentRow = currentRowInTheGrid.Row;
object myId = currentRow["myIdColumnName"];
I hope you understand...because is a rough world out there...
|
|
|
|