|
I wouldn't expect you could because variable names are stored only in your code, once you've compiled they go away. You could tell things like class name, etc., but not variable name.
|
|
|
|
|
That figures. I just wanted to do some screen dumps while I develop/run and see the values of the variables. I was hoping the variable names could be auto-generated.
Anyway, thank you for the quick reply.
|
|
|
|
|
RascalRobot wrote: wanted to do some screen dumps while I develop/run and see the values of the variables
It's called the debugger, it comes with VS
only two letters away from being an asset
|
|
|
|
|
That would work if I were allowed to install VS on the target machine.
I am only allowed to install the final .exe on the target which is not
connected to our network. In other words, no debug tools allowed.
|
|
|
|
|
There is the thing about being specific in your request. You said, "while I develop/run". To me this implied a development environment.
Your left with trace output, event logs, remote debugging, etc.
only two letters away from being an asset
|
|
|
|
|
Two thoughts - one you could either use Tracing or you could do the following:
http://blogs.msdn.com/yosit/archive/2003/06/20/9024.aspx[^]
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
possible if and only if it is a class level variable! it becomes a fields, if it just has a scope in a method alone, 100 % not possible
experiencing the experience
|
|
|
|
|
I have a nifty little app that saves information from a richtextbox to an access table and retrieves it. doing inserts, deletes and selects work fantastic every time, but the portion where i try to do a simple Update statement fails miserably.
here is the updat ecode i am using:
OleDbCommand oc = ocom;<br />
<br />
oc.CommandText = "UPDATE hold SET nm = @nm, content = @cont WHERE [id] = @id";<br />
<br />
oc.Parameters.Add("@id", OleDbType.Integer).Value = id;<br />
oc.Parameters.Add("@nm", OleDbType.VarChar).Value = nm;<br />
oc.Parameters.Add("@cont", OleDbType.VarBinary).Value = b;<br />
<br />
oc.Connection.Open();<br />
<br />
oc.ExecuteNonQuery();<br />
oc.Connection.Close();<br />
whener i run this, i get no exceptions or cute messages, and it isnt hidden in a try/catch statement and just getting overlooked, it just runs, but doesnt actually update the table. Has anyone seen this before?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
I already figured it out... This has been bothering me for months, too. the difference is pretty subtle:
OleDbCommand oc = ocom;<br />
<br />
oc.Connection.Open();<br />
<br />
oc.CommandText = "UPDATE Hold SET content = @cont WHERE [id] = " + id.ToString();<br />
<br />
<br />
oc.Parameters.Add("@cont", OleDbType.VarBinary).Value = b;<br />
oc.ExecuteNonQuery();<br />
oc.Connection.Close();<br />
oc.Connection.Dispose();<br />
oc.Dispose();
Apparently, Access doesnt like it when you parameterize the id in the where section.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Hi!
I have MS SQL Server 2005 installed on my system. I am using NHibernate to interact with my database named 'BRUSDB'. I have set the following configuration for nhibernate:
<configuration>
<configsections>
<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvi der"
="">
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2005Dialect"
="">
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"
="">
<add
key="hibernate.connection.connection_string"
value="server=server; database=BRUSDB;user=sa;pwd=sorcim"
="">
when i run the program The type initializer for 'NHibernate.Cfg.Configuration' threw an exception:
'System.TypeInitializationException'
at line:
Configuration cfg = new Configuration();
If any one has know then kindly guid me.
Thanks.
|
|
|
|
|
Don't post the same question twice, esepcially an hour apart.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The contents a pasted in the first post were completely appeared there. I tried it again to enable the viewer interpret the message. But agin the same hell occured.
|
|
|
|
|
First, I am using sql statement to create table like "CREATE TABLE"; I have several tables to create with a lot of fields and I find out it is very inconvenient to do. I keep getting sentax error and it takes me time to fix. I want to know if there is any other way to do that if I don't wnat to do the wizard.
Does microsoft access provides a translator for sql. Assume that I have the table in access, can it gives me the correspondent sql statement for that table?
The sedcond question I have, I also wnat to create an access file (.mdb) for that table. Right now I have to create an empty file than put the table to it. I mean an empty access file from ms access. So how can I create an access file
here is the way I do it
<br />
OleDbConnection dbConnection;<br />
dbConnection = new OleDbConnection();<br />
string tableName = "Table Name";<br />
dbConnection.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; " +<br />
"Data Source = " + Application.StartupPath + "\\EmptyFile.mdb";<br />
show how can I use the OleDbConnection to create a new access file before I put any table to it
also how to autoincrement the primary field or set it to true?
-- modified at 13:53 Friday 8th December, 2006
|
|
|
|
|
Sorry if this sounds rather blunt, but, for a beginner, you are trying to do stuff that is too advanced. Suggest that your take your time learning the basics using those on-line tutorials that I pointed you towards before you try anything more complicated. When you have learned the basics (don't expect to run before you can walk), you can then think about learning more advanced stuff or you will end up being totally confused.
Two good books for you to study after you have learned the basics are ...
(1) Programming SQL Server 2005. By Bill Hamilton. Publisher : O'Reilly
(2) Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL & .NET, Third Edition. by Dejan Šunderi. Publisher : McGraw-Hill/Osborne
modified 1-Aug-19 21:02pm.
|
|
|
|
|
I'm developing restaurant software for my family business and need some input as to how to implement an ordering system. I will have 2 computers networked together, one being at the cash register (REGISTER), and the other in the kitchen (KITCHEN). Here is the scenario that I'm envisioning.
Waitress(er) takes the order, submits to the cash register. Order gets inputted into (REGISTER) and is stored into a database. Database will have 2 linked tables, the main table will have [table_number, number_of_people, total_due, date, order_number (primary key)] The second table will use order_number as the foreign key and then have order information[ quantity, item, subtotal]. I think I've got a handle on the REGISTER software...
My problem is, what type of client software must be put onto KITCHEN so that it can monitor the database for changes? Ideally I would like a messageBox to pop up with the order information that can be dismissed when the order is completed. Would the CLIENT software check (every 5 secs?) the up to date of the DB? Not quite sure what to do. Please help
Henry
|
|
|
|
|
i would recommend u to go for event driven programming,
subscriber / publicher architecture,
u can also go for message queuing so that u can put ur orders in a queue and process them
|
|
|
|
|
You could use this type of mechanism
http://www.codeproject.com/cs/database/chatter.asp[^]
You are starting out simple enough but you'll probably find you'll need, or want, the system to do a whole lot more, like tying the order items and qty to your inventory so you can analyze loss and effeciency etc. I've built retail systems in the past to control grocery store check and inventory management.
only two letters away from being an asset
|
|
|
|
|
I have written this and the data don't want to enter in my Microsoft Access database.
What is wrong????????????
using System.Data.OleDb;
private void Button1_Click(object sender, System.EventArgs e)
{
string SQL;
OleDbConnection connection = new OleDbConnection
(@"Provider=Microsoft.Jet.OLEDB.4.0; " + "Data Source=" + Server.MapPath("baza.mdb"));
OleDbDataAdapter sql = new OleDbDataAdapter("select * from Korisnici", connection.ConnectionString);
connection.Close();
connection.Open();
SQL = @"insert into Users ([UserID],[Name],[Surname],[Address],[Phone],[YearsOld],[UserName],[Password],[Privilegy]) VALUES (";
SQL = SQL + @"'"+TextBox9.Text+"'"+"'";
SQL = SQL + @"'"+TextBox8.Text+"'"+"'";
SQL = SQL + @"'"+TextBox7.Text+"'"+"'";
SQL = SQL + @"'"+TextBox6.Text+"'"+"'";
SQL = SQL + @"'"+TextBox5.Text+"'"+"'";
SQL = SQL + @"'"+TextBox4.Text+"'"+"'";
SQL = SQL + @"'"+TextBox3.Text+"'"+"'";
SQL = SQL + @"'"+TextBox2.Text+"'"+"'";
SQL = SQL + @"'"+TextBox1.Text+"')";
OleDbCommand myCommand = new OleDbCommand(SQL, connection);
myCommand.ExecuteNonQuery();
connection.Close();
Response.Redirect("WebForm1.aspx");
}
Vasildb
|
|
|
|
|
We'll a few things..here's a start:
1. The line "OleDbDataAdapter sql = new OleDbDataAdapter ..." is unused and can be removed.
2. You're not validating the value of your textboxes. So, here's a list of all the problems you're going to have from that:
a) SQL injection
b) A single tick mark could cause your query to fail.
c) Invalid types could also cause your query to fail.
3. Your "@" is unneccessary if you're trying to modify how the compiler is treating the C# string immediately following.
4. Opening/closing of your connection should occur as close together as possible. So, you should move your open just before your call ExecuteNonQuery.
5. Why are you closing the connection right after your creation of the OleDbDataAdapter? It's unneccessary.
6. And the one million dollar answer that you wanted, your second set of tick marks (') for each value should be commas rather than tick marks.
For future cases, I would suggest looking at the string you're building up (if you indeed choose to keep building dynamic SQL like that) in the debugger. I would highly suggest either creating a parameterized SQL string or a stored procedure (my recommendation) for such cases.
Good luck.
|
|
|
|
|
Hi!
I have MS SQL Server 2005 installed on my system. I am using NHibernate to interact with my database named 'BRUSDB'. I have set the following configuration for nhibernate:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="nhibernate"
type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
</configSections>
<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2005Dialect"
/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"
/>
<add
key="hibernate.connection.connection_string"
value="server=server; database=BRUSDB;user=sa;pwd=sorcim"
/>
</nhibernate>
</configuration>
when i run the program The type initializer for 'NHibernate.Cfg.Configuration' threw an exception:
'System.TypeInitializationException'
at line:
Configuration cfg = new Configuration();
If any one has know then kindly guid me.
Thanks.
|
|
|
|
|
This indicates that your config file is invalid. You've probably forgot to add a closing XML tag or added an extra one somewhere. Unfortunately I can't tell, because your post interpreted the < and > tags as HTML tags.
|
|
|
|
|
current_item_data_row["MenuPrice"] = Convert.ToDecimal( targetRow["MenuPrice"] ) * Convert.ToInt32( this.textBox_OtherQuantity.Text ); /*******/
How can I change this so that 19.9 will be displayed at 19.90 (no $ pleasE)
Thanks
e
|
|
|
|
|
Why not display it as a string and use format?
|
|
|
|
|
because the dataset is formatted as a decimal, and then the dataset is bound to the datagrid. Is there is a way to easily format the datagrid to show string.
|
|
|
|
|
Change the DataBinder.Eval(Container.DataItem, "YourFieldName") to either a server side function or inline.
|
|
|
|