|
I want to insert a RTF file to an Access DB and i tried to insert only the RTF source to a MEMO field and when the command is executed i recive an error "SQL SYNTAX something" if anyone can help me with code please do...
|
|
|
|
|
Most likely the RTF has a single quote in it, which corrupts the SQL syntax. Try creating and calling a stored procedure instead of concatenating together a string containing the SQL INSERT statement, this will allow you to pass single quote characters without messing up the SQL syntax.
Judah Himango
|
|
|
|
|
Access doesn't support stored procs. Besides, the correct resolution here is to use parameterized queries - even with stored procs. Not using parameterized queries and instead relying on string concatenation to build SQL expressions opens you up for SQL injection attacks.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
This is most likely because your SQL expression contains a quote (as Judah said) but instead of just resorting to stored procedures (especially since Access doesn't support them), use parameterized queries.
When you use string concatenation to build SQL expressions, you not only run into problems like this but face SQL inject attacks, which are extremely easy to exploit and can be the most devastating (yeah, DDoS'ing a site sucks, but stealing credit card numbers or something else of value without the site knowing is far, far worse). If you're interested, search prior discussions on this board (heck, just go back to yesterday where I had to explain this 4 times to different people).
Something like the following would solve the problem of both escaping quotes and keeping your database secure:
using (OleDbConnection conn = new OleDbConnection(connectionString))
{
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "insert into Whatever (RTF) values (?)";
cmd.Parameters.Add("@RTF", OleDbType.LongVarWChar).Value = richTextBox1.Rtf;
cmd.ExecuteNonQuery();
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Apparent it is not possible to change the height of a TextBox. But I want to display two or three lines of text. Which control can I use and/or should I use?
Regards
patrick
|
|
|
|
|
Set Multiline property to True , You can enter more than one line as well as change the height.
|
|
|
|
|
Iam going to develop something like dictionary but it will be distrebuted on cd, and it will have about 100,000 record (the record about 5 fields some fileds will be 800 character)
i do not know what is the database to use with this application?
sure it will not be sql server coz of cost resons
and i think that access will be weak to this
thnx in advance
|
|
|
|
|
How about MSDE? It is basically a SQL Server Engine, but limited to about 5 or 10 concurrent connections, and you can redistribute your application with the MSDE engine at no extra cost.
Also, if you are going to create a database application you might want to consider improving your spelling ability. The following words are all misspelled: distrebuted fileds coz resons thnx
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
|
Hello,
Unfortunately, in the ".NET Compact Framework Programming with C#" is the TabControl not explained so I have five questions referring to the TabControl on Smart Device Application:
1) How can I when I go from another Form1. to the Form with the TabControl to select an initial TabPage?
2) When I want to create a special control for a TabPage which I cannot design with the VS.NET Designer in the corresponding tabPage, what do I have to quote that the Control is on the certain tab page?
3) When I click from one tabPage (JobDetails) to another tabPage (ClientDetails) the SelectedIndexChanged Event is occured. But how can I indicate in this event that I want for example to the ClientDetails tab Page?
4) How can I take over a parameter from one tabPage to another tabPage?
5) Is it difficult to give a certain tab page a background colour?
Hopefully anybody find time for these questions..:-/
Best Regards
mat
|
|
|
|
|
1) Just show the right form. Set the SelectedIndex to the tab you want.
2) Confusing question but i'll try. If you want to know what tabpage a control is on go control.Parent. If you are trying to add designer support search google.
3) After the event occurs you can check the selectedtab or selectedindex. The eventargs don't have any additional info.
4) ???
5) No. Just get the TabPage you want and change the Background like you do on everything else.
|
|
|
|
|
hi guys,
I am building a employee data base management system with lot of datagrid. Its basically a windows app. I am building the whole application in 3 tier architecture. I want to add a combo box to the datagrid. i got some sample from net. They are saying abt adding datagridTextcolumn in datagrid table styles. I tried adding that. No errors but not results i cannot see the combo box. how can i exactly put the combo box in the right cell. How can i map them i tried mapping properties but it does not work and will not work as i am filling dataset using a function in the wrapper class to get a dataset and setting this as the datasource to the grid. so how can i do that any ideas. is my question a bit confusing or vague. sorry for that. how can i do that plz tell me a neat way of doing that.
thanks in advance
anand
anand
|
|
|
|
|
|
Hi~
Can I add item to "new" of the desktop context menu?
Thanks
|
|
|
|
|
Hi,
I can't figure out how the textbox 'knows' where to draw. Can I get a handle to that rectangle and 'move' it over?
thanks,
Roland
|
|
|
|
|
Is there any way I can login to a remote machine from code to allow for a file copy?
If the folder is mapped and connected (entering username/password) it works fine copying to "\\server\share\filename" But if not, I get access denied exception.
|
|
|
|
|
Hello,
I want to save the name of the company in the textBox2. The problem which occur is with the JobId. I will get the JobId number from a previous page as a string. Here I have quoted an example JobId. (the JobIds are saved in the database as uniqueidentifier). The Problem occurs in the ExecuteReader. I think it concerns that the parameter @JobId is of type uniqueidentifier and the the quoted jobId here is from type string. So it occurs a Data conversion failed. error.
jobId = "D4DF269F-F9FB-4C88-A005-11C98B38818A";
this.dataSource = "\\Program Files\\MobileHelpDesk.sdf";
this.strConn = "Data Source = " + dataSource;
this.connection = new SqlCeConnection("Data Source = " + dataSource);
SqlCeCommand command = new SqlCeCommand();
command.Connection = connection;
command = connection.CreateCommand();
command.CommandText = "SELECT c.CompanyName, c.ContactLName FROM Client c INNER JOIN JobDescription p ON p.EmailClient = c.Email WHERE p.JobId = ?";
command.Parameters.Add( "@JobId", jobId);
connection.Open();
drdrDB = command.ExecuteReader();
while (drdrDB.Read())
{
textBox2.Text = drdrDB["JobId"].ToString();
}
drdrDB.Close();
connection.Close();
Does anybody know how can I solve this problem or parse the jobId string in the corresponding type?? or is there another error? But the Select String is correct, I tried it in VS.NET.
thx
patrick
|
|
|
|
|
The parameter value needs to be a System.Guid[^] if the SQL Server type is a uniqueidentifier.
For example:
Guid jobGuid = new Guid(jobId);
command.Parameters.Add("@JobId", jobGuid);
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Thank you very much, now it works!
patrick
|
|
|
|
|
I have received a request from a client to limit the amount of streaming video that users can download from their site. A company has its own webspace, but leases space and bandwidth from an ISP when users at the company click on links to watch videos.
I can imagine an object that doles out "streaming objects" that know how much data they have streamed, and when the limit is achieved no more "streaming objects" are allowed to be created.
Problem is, I don't know if there is anything server-side that I can use to stream the files to the client.
Can anyone point me in the right direction?
|
|
|
|
|
i think u'r pointer is looking for a "Traffic Shaper". i don't know of open source code one
there are no facts, only interpretations
|
|
|
|
|
Hi.
I've been looking everywhere for sample source to help out with dynamic properties. I want to create a new custom control that contains a new property closely replicating the standard (DynamicProperties) property in MS controls. I want to be able to either create it from scratch or somehow override the behaviour of the (DynamicProperties) property to allow the control to use a global value whenever an object is instantiated from the same control class. As per current (DynamicProperties), each time the code is compiled a reference will need to be compiled into the InitializeComponent for each selected Dynamic Property.
Thanks in advance
Les
Les
|
|
|
|
|
Hi all I'm again.
I'm looking for the Input and Output Control Codes for the following Consts:
IOCTL_CDROM_GET_CONTROL
IOCTL_CDROM_PAUSE_AUDIO
IOCTL_CDROM_PLAY_AUDIO_MSF
IOCTL_CDROM_RAW_READ
IOCTL_CDROM_READ_TOC
IOCTL_CDROM_RESUME_AUDIO
IOCTL_CDROM_SEEK_AUDIO_MSF
IOCTL_CDROM_STOP_AUDIO
I can't find any information about the control codes. I've searched in the MSDN in different foren, in the Plattform SDK and in the Windows DDK. I only get the Consts like listed on top of this thread but nowhere the Codes.
The main problem is, that the API "DeviceIOControl" needs the Control Codes.
Hope, that someone can help me.
Thanks in advance
BB
|
|
|
|
|
If you install the Platform SDK (BIG install!), you can search the header files (*.H) for the constants your looking for. They probably show up like:
#define IOCTL_CDROM_GET_CONTROL 0x0400
or something very similar.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks men.
Now I know my problem. I haven't got the full Platform SDK.
Best wishes
BB
|
|
|
|