|
Use a blank space before WHERE, it should run.
Sheo
|
|
|
|
|
its still not working.. i got this error..
Syntax error in UPDATE statement.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Syntax error in UPDATE statement.
Line 80: {
Line 81: // cmd.CommandType = CommandType.Text; Default is text, ut if you change to something else you should change this here.
Line 82: cmd.ExecuteNonQuery();
Line 83: //cmd1.ExecuteNonQuery();
Line 84:
|
|
|
|
|
what the right process of executing sql in my knowledge is like this.
This is compact
//To update/insert/delete records
stirng Sql = "Update or whatever sql statement"
OleDbCommand dCmd = new OleDbCommand(Sql,conn);
dCmd.ExecuteNonQuery();
dCmd = null;
// for Select statement
stirng Sql = "Update or whatever sql statement"
OleDbCommand dCmd = new OleDbCommand(Sql,conn);
OleDbDataReader dReader = dCmd.ExecuteReader();
DataGrid1.DataSource = dReader;
DataGrid1.DataBind();
dReader.Close();
dCmd = null;
In your case you are using the Sql into the Command object and again assiging the text property to command object to the same sql.
Please try this way, i hope this should work.
Sheo
|
|
|
|
|
Here's the situation:
I’m building an application that is going to be used buy a ton of different people in my organization. So security is becoming a big deal. Someone in this department can do this function X, but a different department can’t do that function X and so forth. This application is going to grow and evolve. I’m trying to figure out the best way to keep track of who can do what, and ensuring that people are only doing the things they are allowed to do.
Right now I’ve got something like this CurrentUser.IsMemberOf(“Administration”) The IsMemberOf method checks to see if the user is in the supplied group. Only problem is that if Administration ever gets renamed or a developer misspells it, then the compiler won’t ever catch it and the application will have a runtime error.
I was thinking that if I created enums for all of the various functions like
CreateUser
EditUser
EditGroup
EditDocument
ChangeDocumentState
Etc, etc.
Then I could ensure that everything was correct at compile time, and as my application grows I can just add in additional values for the enum.
Then I would do something like
bool result = CurrentUser.CanPreformFunction(Functions.EditUser) ;
Is this a good way to design application functional security? Or is there a better more elegant way?
I don’t think Method Security will work in my case either, because I need to modify the UI depending on the user’s rights, not what they can call, etc.
Let me know!
Thanks!
Ryan
|
|
|
|
|
If you change the enum you will have to recompile all code that uses it. If that is not a problem, it is a good way to go.
---
b { font-weight: normal; }
|
|
|
|
|
Hello all.
My .Net solution uses a C# dll, as well as a managed C++ dll that is attempting to call a MS Embedded Visual C++ 4.0 dll.
The C# and managed C++ dlls are part of the .Net solution as 'projects'. When I build and run this project in the emulator, I also wish to load the win32 (non .Net) dll into the emulator so that the managed C++ can use the win32 dll.
Is this possible? Any help would be great!
|
|
|
|
|
Um...
P/Invoke from C#? If you can do native code does LoadLibrary work?
Alex Korchemniy
|
|
|
|
|
I am using P/Invoke from the C# to interface to LoadLibrary and GetProcaddress. However I need to make the function call within a managed C++ module because C# does not handle function pointers (needed to call the function in the win32 dll).
The issue is loading the win32 dll that is not part of the .Net environment into the emulator so that my C# dll can call it....
Do you know how to do this?
|
|
|
|
|
Hello list,
I've found myself in a bit of a pickle in trying to do something that is intuitively simple. I'm relatively new to coding, esp. in C#, so I hope you don't mind a novice-level question.
Here's what I need to do:
1. I have a text file with some data, and each line in the text file is a number of type "double".
2. I would like the user to be able to click a button on the application's form, navigate to this text file and be able to read ALL available lines (numbers) into an array of doubles.
I've figured out how to put the button on the form and the use of the OpenFileDialog. I just don't seem to be doing the reading of data into the array correctly.
Your help would be greatly appreciated! Thank you.
|
|
|
|
|
You might want to check out the StreamReader class. It has a ReadLine method which should be able to help you. The Convert class would be able to help you do the conversion from string to double.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Check out http://www.codeproject.com/cs/database/CsvReader.asp
|
|
|
|
|
Hi All,
I just findout a special button control: AquaButton for .NET for my application. I think it's really cool.
http://www.econtechvn.com/en/aquabutton_detail.htm
But anyone tried this before?
I'm going to buy it and I need your comments.
Thanks,
NicVan
|
|
|
|
|
I'd like to point out that a single button is not going to improve the user interface. You must have a well thought out UI in the first place. In addition, the basic button is very easy to implement. Personally, I'm a graphics artist, and I don't find the other button shapes at all apealing.
Alex Korchemniy
|
|
|
|
|
|
hey guys, check out my new program at:
http://www.angelfire.com/hi5/mp3alarmclock/
If you guys have any questions, or want source code, please ask me!
D
|
|
|
|
|
Why not make an article from it?
<italic>Work hard, Work effectively.
|
|
|
|
|
I have a ton of picture boxes on a form, I made it so that if you click one it opens an open file dialog box and then opens the picture into the picture box, all seems fine. How do I code so that I can click on any picture box, and call a function that does that without making one for each picture box?
|
|
|
|
|
Tie all the click events to the same event handler.
---
b { font-weight: normal; }
|
|
|
|
|
That still would be horrilbe since I would have to make all picture boxes call that event. How do I make it not have to do that?
|
|
|
|
|
No, it's not horrible. I saw that you solved it that way after all.
---
b { font-weight: normal; }
|
|
|
|
|
I thought that I would have to make a differnet sub for each picture box, not that I could just have all click statements call into a sub.
|
|
|
|
|
Yes, as it was suggested, set the Click event of every picture box to the same handler. Once in the handler, popup the File Open dialog, and cast the sender (first parameter) to a picture box and set the image.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
|
Event handlers generaly have this signature control_event(object sender, EventArgs args) . You box sender to type of your control to use, e.g. object stg = (ComboBox)sender.SelectedItem; . If you subscribe more controls events to this handler, this way you will work with *that* control which raised the event.
David
|
|
|
|
|
So where do I put that code.
private void map11_Click(object sender, System.EventArgs e)
{
object snd = (ComboBox)cmbLevel.SelectedItem;
ChangePicture(snd);
}
private void cmbLevel_SelectedIndexChanged(object sender, System.EventArgs e)
{
szLevel = cmbLevel.Text;
}
private void ChangePicture(object sender, System.EventArgs e, object snd)
{
// Display an OpenFileDialog so the user can select a Cursor.
openMap.Filter = "GIF Files|*.gif";
openMap.Title = "Select a GIF File";
openMap.Multiselect = true;
// Show the Dialog.
// If the user clicked OK in the dialog and
// a .GIF file was selected, open it.
if (openMap.ShowDialog() == DialogResult.OK)
{
if(openMap.FileName != "")
{
// Assign the images to the picture box according to the selected level.
if (szLevel != "Bottom")
{
"""PICTURE BOX""".Image = Image.FromStream(openMap.OpenFile());
}
if (szLevel != "Top")
{
"""PICTURE BOX""".BackgroundImage = Image.FromStream(openMap.OpenFile());
}
}
}
|
|
|
|