|
that means there is a syntax error at the query string..
just show code and maybe there would be some help..
good coding
|
|
|
|
|
"this is my code now plz help me according to this" here "password" is database field;" thx
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\C#Projects\\practice1\\SMSDB.mdb;Persist Security Info=False");
con.Open();
string updata = "update SMSDB set password= '"+txtnewpwd.Text+"' where password='"+txtoldpwd.Text+"'";
OleDbTransaction tx = con.BeginTransaction();
tx.Commit();
OleDbCommand cmd = new OleDbCommand(updata,con);
cmd.ExecuteNonQuery();
con.Close();
m.reehanmunir
|
|
|
|
|
An example of what you are doing will be helpful. Did you remember to put quotes around the passwords?
It should look something like this:
UPDATE usertable SET password = 'newpassword' WHERE password = 'oldpassword';
When creating the UPDATE string, you will need to surround your password variables with the single quote. That is the only thing I can think of which may be causing the problem.
I sometimes find it helpful to use a SQL Editor for creating my SQL statements. It saves me a bunch of time from having to try and retry different commands through code. I don't use MSAccess so I am not sure what type of GUI editor they may have.
|
|
|
|
|
"This is my code now plz help me according to this code" here "password" is the field of database;"
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\C#Projects\\practice1\\SMSDB.mdb;Persist Security Info=False");
con.Open();
string updata = "update SMSDB set password= '"+txtnewpwd.Text+"' where password='"+txtoldpwd.Text+"'";
OleDbTransaction tx = con.BeginTransaction();
tx.Commit();
OleDbCommand cmd = new OleDbCommand(updata,con);
cmd.ExecuteNonQuery();
con.Close();
m.reehanmunir
|
|
|
|
|
It is not necessary to create a transaction. Transactions are used when you plan on doing several SQL calls and there is the possibility of a problem. If there is a problem, a transaction lets you rollback any change prior to anything being fully committed to the database.
In the case of the password, you have the one SQL statement and probably do not want it in a transaction. If you did want a transaction, the commit will need to be AFTER your Execute call. As it is, the Transaction in the code is not doing anything and can probably be removed.
Try putting a space between password and the '='.
|
|
|
|
|
Hi.
I am extracting fields from a FoxPro database.
For reasons that I won't go into, one of the character fields contains an array of 4 characters.
The first character is almost always a Unicode-null.
Now .. When I read this field using a System.Data.DataRow .. it thinks the field is a blank string (String.Empty).
This is because, a string variable is basically a character array, terminated by a unicode-null value.
My character array is therefore immediately terminated (as the first character is a null character).
How on earth do I extract these field values?
I can do this in VBA (in Access) using the same connection string. It returns a string of the individual unicode characters ... but in .Net (both C#.Net and VB.Net) I get returned a blank string.
HELP ?
My Code<br />
OleDbConnection _connection = new OleDbConnection( @"Provider=VFPOLEDB.1;Data Source=C:\DataFolder\;");<br />
<br />
string strSelect = "SELECT * FROM table1";<br />
<br />
OleDbDataAdapter _dataAdapter = new OleDbDataAdapter(strSelect, _connection);<br />
OleDbCommandBuilder _commandBuilder = new OleDbCommandBuilder(_dataAdapter);<br />
DataSet _dataset = new DataSet();<br />
<br />
_dataAdapter.FillSchema(_dataset, SchemaType.Source);<br />
_dataAdapter.Fill(_dataset);<br />
<br />
foreach(DataRow dr in _dataset.Tables[0].Rows)<br />
{<br />
object thisField = dr["myField"];<br />
}<br />
<br />
<br />
string myStr = "Hello World";<br />
<br />
char myChar = Convert.ToChar(0);<br />
<br />
myStr = myStr.Replace("l", myChar);<br />
<br />
Console.Writeline ( myStr );<br />
<br />
Any help would be appreciated.
Thankyou
MKeeper
"imagine how stupid the average person is ...
now imagine that half the planet is more stupid than that!"
|
|
|
|
|
There is a language called Lua. It is script writing for video games.
I want to be able to define syntax rules, compilation, intellisense, etc..
here is an example program I found
http://www.wowinterface.com/downloads/info4222-WoW_UI_Designer.html[^]
Would I make an add in to define rules for the language inside the IDE? Any links or pointers would be great.
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
-- modified at 10:47 Tuesday 23rd May, 2006
|
|
|
|
|
we have a web app which uses a class library. and that class library holds all the DB calls. in each DB call in the class library, there's a little section that grabs the DB connection string, like this:
<br />
string connString = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;<br />
SqlConnection conn = new SqlConnection(connString);<br />
works fine.
i now need to make a console app which uses some of the DB stuff from the class library. so, i make a console app project, add a reference to the class lib, and etc.. it builds fine. but when i run it, when it gets to the lines above, it dies because ConfigurationManager is null. so, i guess it's not initialized.
my questions:
1. where is ConfigurationManager initialized in a web app?
2. how does the class library know about it?
3. why doesn't that happen in a console app?
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Add a config file to your console app and put the connection strings in there
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
yes, i know.
but the problem is that the ConfigurationManager isn't visible globally in the console app, as it is in the web app. so, even if the ConfigurationManagerdoes have the connection string, the DB code can't get to the ConfigurationManager.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
right click project -> Add References
Scroll down to System.Configuration
Click OK
Its now accessible
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
|
|
Actually, I think your problem is real simple. It's just that you didn't get the config file where it needed to be. You can add an app.config to your project, but it doesn't do anything for you until it's copied out to the directory where your .exe is and renamed. Like my exe is TestConfigManager.exe, so I have to copy my app.config out to where that is and rename it to TestConfigManager.exe.config. I usually just write a postbuild to handle it.
www.logifusion.com
|
|
|
|
|
you're exactly right.
i was assuming the documentation for ConfigurationManger.OpenConfiguration (or whatever that member is called) allowed you to specify the config file you wanted to use. apparently, it doesn't. once i renamed, and changed that call to use the EXE's name, it all worked.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
If you add the configuration file to the project via VS .NET (Application Configuration File), then it does the copying for you.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Greetings:
I am looking for a way to embed the date and time of the build of my Visual Studio 2003 C# application. That is, I would like to have some strings in my code that are automatically set at build time with the system date time and will provide me with an easy way to display the build date and time in an "About" box at run time.
Thank you in advance,
Mark
-- modified at 9:53 Tuesday 23rd May, 2006
|
|
|
|
|
As far as I know, you can only get the creation time. There are no embed datetime in file.
FileInfo fi = new FileInfo(Process.GetCurrentProcess().MainModule.FileName);
MessageBox.Show(fi.CreationTime.ToString());
|
|
|
|
|
System.DateTime.Now.ToString() -> this returns a string with the date and time of the windows at run.
|
|
|
|
|
Thanks but, it is not current time I am looking for. It is the BUILD time of the project. In standard WIN32 under "C", you can define these MACROS:
#define _COMPILE_DATE
#define _COMPILE_TIME
These macro's are updated with the system date and time by the compiler pre-processor when the file is built.
Cheers,
Mark
|
|
|
|
|
|
I don't think you can really embed that kind of information. You could do something tricky like make a batch file that writes the current date/time to a file that is an embedded resource in your assembly. Call that batch file on prebuild and then you can use Assembly.GetManifestResourceStream to pull the contents of that file out and get your date.
If you're interested, CruiseControl has a labeler that will mark the build version as the date:
http://confluence.public.thoughtworks.org/display/CCNET/Date+Labeller[^]
www.logifusion.com
|
|
|
|
|
You could easily do this with Visual Studio 2005 which utilizes MSBuild files which are pretty easy to work with; all you have to do is modify your .csproj file. However, this only works for VS2005, as 2003 does not use MSBuild AFAIK.
You *might* be able to pull this off using pre-build steps, but I'd rather not comment on how, as that is nothing trivial.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Islamic Domination: Coming to a Jewish state near you!
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Hi,
I'm trying to place a control onto a form behind a picturebox. Some area's of this picturebox
are defined as transparant. Now I run into the problem of not seeing the controls anymore.
What does happen is the transparent area is taking the same color as the form so it looks transparant but not truly is. What am I doing wrong?!
thanks in advance
Here is some sample code..
<br />
Bitmap bmp = new Bitmap(this.ImgBackground.Image); <br />
bmp.MakeTransparent(Color.FromArgb(255,0,255)); <br />
this.ImgBackground.Image= bmp;<br />
|
|
|
|
|
set yourPicturebox.BackColor = Color.Transparent
|
|
|
|