|
When you get a System.NullReferenceException , typically you are trying to access a field, property method, event of an object that is null. Have you tried steping through the code, if it occurs on the last line, it is possible that either WordApp or Selection could be null.
|
|
|
|
|
How can i protect my password for connection to the Microsoft Access Database?
Can i use Store Procedure with Access Database?
|
|
|
|
|
Sasuko wrote: Can i use Store Procedure with Access Database?
I believe that is possible, nowadays.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Access can't use Stored Procedures... that I know. You can only create querys (sort of like views) but that's about it. Can you use macros or modules as stored procedures? I'm just thinking I don't really have an idea.
daniero
|
|
|
|
|
I don't use it, but I've been assured that SP exist in the newer versions.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Roger, I just created an access file with office 2003, and didn't see anything related to stored procedures, may be they're just not straigh out visible there.
As for protecting password... are you using VS 2005? if so, there's a way to encrypt information into the web.config file. If I find information I'll tell you, but it shouldn't be hard to find information about it.
daniero
|
|
|
|
|
[How can I protect my password for connection to MS Access database?]
Not too sure what you mean here, but I normally put use a config file with the user name and password encrypted. The code then decrypts the values and into the connection string.
Sorry, not sure if I answered that one properly
[Can I use Stored Procedure with Access Database?]
This really depends on the version of Access you are using. I think Access 2003 allows you to either use its Jet engine (I think they still call it that) or Msde (local SQL server). This is depends on how the Access database was setup.
If it was setup using Msde, then all linked tables and queries reference SQL server tables and stored procedures. However, if it was setup with the Jet engine, then it will be Access queries.
In both cases, if you are using ADO, then the queries can be treated as stored procedures in your ADO.Command object anyway. The restriction with the Access query is that you cant use things like return value, but both accept parameters.
If you are using an older version of Access then it uses the Access query and the Jet engine.
I hope this helps [anyone feel free to correct me if my memory has failed me with Access as it's been a little while since I used it]
Peter
|
|
|
|
|
Hi,
I have the following code in an unsafe section of code:
int scan0 = data.Scan0.ToInt32();
byte * colPixel;
byte * rowPixel;
byte innerColorB = innerColor.B;
byte innerColorG = innerColor.G;
byte innerColorR = innerColor.R;
byte innerColorA = innerColor.A;
int stride = data.Stride;
for (int y = 0; y < height; y ++)
{
rowPixel = (byte *)(scan0 + y * stride);
for (int x = 0; x < width; x++)
{
colPixel = rowPixel + 4 * x;
*colPixel = innerColorB;
*(colPixel + 1) = innerColorG;
*(colPixel + 2) = innerColorR;
*(colPixel + 3) = innerColorA;
}
}
I'm basically setting all pixels of a bitmap to a specified color. I know I could use the FillRectangle function but I don't want to .
My question is if anyone here might have an idea how this could be performed better/faster.
|
|
|
|
|
Robert Rohde wrote: int scan0 = data.Scan0.ToInt32();
I don't lint the look of this. I always turn it into a byte * from the get go. I'm not sure if C# will magically deal with 64 bit, where this code would be wrong.
I think the way I do it is faster, which is to create a byte * out of scan0, then keep adding to it as I go, instead of calculating the position every time. You should read my image processing articles on this site, they all do it the same way.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your help. Now it performes a bit better (although not really significant):
byte * p = (byte *)(void *)data.Scan0;
int nOffset = data.Stride - bitmap.Width * 4;
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
{
p[0] = innerColorB;
p[1] = innerColorG;
p[2] = innerColorR;
p[3] = innerColorA;
p += 4;
}
p += nOffset;
}
Isn't there a way to set a bunch of bytes in one step instead of having to move through each pixel? As I said the whole bitmap should be filled with one color. Is there a way to prepare a byte array or something containing all bytes for one row and than just copying it y times?
|
|
|
|
|
I've not found a memcpy type function or a memset, for that matter, in the framework. However, given that the color does not change, you could turn the RGBA values into an int, and then set it in one step for each pixel. nOffset will also be a multiple of 4, so you could set the pointer to be an int * all the way through, instead of having to cast it, just make sure you divide nOffset by 4 to match.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a class which wraps the mpr.dll functions that I've used in may applications before. But now I'm attempting to use them in a WebService and the WNetAddConnection2A fails everytime. Any known issue with using these method with Web Services ?
|
|
|
|
|
Of course it does! The ASPNET account that your webservice runs under, by default, doesn't have permissions to any other network resources. No permissions, no access and the call fails.
Either grant the ASPNET account permissions to the network resource you are trying to map to or create a user account that has those permissions and change the account your webservice runs under.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So even though I providing a username and password in the call to WNetAddConnection2A, I need to give permissions in order to even make the call ?
|
|
|
|
|
Does the account name you're providing have the appropriate rights to the network resource? Are you sure your using the correct name and password? Things can be a bit confusing in a domain environment and different in a workgroup.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, the account name I'm providing is the local administrator on that machine. I'm not using any domains at this point. The weird thing is that the function returns immediatly, it seems like there isn't even enough time for the remote machine to accept or reject the call.
|
|
|
|
|
Try changing the account that your web service is running under. I get the feeling that the ASPNET account doesn't have any network resource rights to make a connection to anything.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I've already searched online for instructions on how to do this correctly and attempted it, but have been unable to do so. I've changed the ASPNET user password on both machines to the same password and given the account read/write access to the files. But even after I change the password field in the machine.config file the web server will not load the web service. The only way I get it to function properly is to run the aspnet_regiis.exe command to reset the password toa randomly generated one. Have you ever successfully change the ASPNET password ?
|
|
|
|
|
What are you changing the password for???? There's no reason to do it.
Create an account that your web service will run under and change it to that account in IIS.
On a second thought, why are you mapping a drive inside a web service? This drive mapping will disappear as soon as the current call to the web service returns.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I guess I thought that all ASP.NET web services and applications ran under the ASPNET account. Where do I change the account at ? I know where to change the anonymous access but that is using IUSR_MACHINE account. I don't see anyplace to change the ASPNET user account.
I don't neccessarily have to map a drive, I'm just triing to get access to files on a share on another machine. I have been unable to do so thus far and thought providing a login while mapping a drive would get around the security problems.
|
|
|
|
|
Hi all,
How can I mplement a update of a datagrid with datagrid.datasource = myDataSet?
Thank all
Bye
AlbePes
|
|
|
|
|
Hello all & Greetings.
I have a SQL Table execute a query and results being populated ina GridView ,gv, control. Now, I need to select multiple records from the gv. How can I do this? If this were not possible, is there any other control I can use to populate the results of the sql query which would enable me to selct multiple records from such a control. [for. eg, a listBox control , etc.
Any suggestion would be much appreciated.
thanks,
kishan
cansciences@gmail.com
|
|
|
|
|
|
Hello, I need to design a weekly planner report the report needs to look something like this-->
========================================================================
Monday Tuesday Wednesday n so forth
========================================================================
Date: 11/01/06 12/01/06
Location: ABC XyZ
Time: 10:00 AM 11:00
--------------------------------------------------------------------------
Sr. Dr. SPT Dr. SPT Dr. SPT
Can anyone come with some solution? It would be nice to manipulate the data in the sql server however its not compulsory. By the way its a windows application on C# and sql server at the backend.
I couldnt format this msg properly but basically the Date location time will fall under each day, having a Drs name, his/her speciality and the level for each day. If someone has any solution i would get the sample report scanned and send it to their email address. Also, I am toying with the idea to have an excel sheet and automate it via C# but it does not appeal me though and it would be nice to stick to CR.
Best regards,
Krunchu
|
|
|
|
|
Hi,
I have been looking around and working with the Express editions of C# and SQl Server 2005 for a few days now. Currently I am unable to create a Procedure using the new CLR. From my understanding you must create a "special" stored procedure project that you later use in SQL Server 2005 by creating an assembly and linking to it...
My problem is the Express version of C# does not include the template files for this. As a matter of fact there is no database project folder at all.
I was wondering if there is somewhere I can download the needed templates or if I have to upgrade my version of C#.
Thank you for your time,
Will
I hate users. Not all of them, just the ones who talk.CP member: Al Einstien
-- modified at 14:02 Thursday 12th January, 2006
Cant spell...
|
|
|
|