|
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.
|
|
|
|
|
Hello,
I have the following constants:
<br />
public static string DOCUMENT_NAME_PARSE_EXPRESSION = @"(AG_DOCNAME)(?innerDocName.*?)(AG_DOCNAME)";<br />
public static string DOCUMENT_NAME_INNER_EXPRESSION = @"${innerDocName}";<br />
I have the string that contains something like that:
..some text here .....AG_DOCNAMEtestAG_DOCNAME......some text here...
Now I pass that string into a function:
<br />
private bool ReplaceValueInHTML (string context, string newValue)<br />
{<br />
Regex expression = new Regex(DOCUMENT_NAME_PARSE_EXPRESSION, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.ExplicitCapture);<br />
<br />
Match match = expression.Match(context);<br />
if (match.Success)<br />
{<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
return true;<br />
} <br />
What I am trying to do is this: After I find that substring (AG_DOCNAMEtestAG_DOCNAME), I want to replace "test", with the newValue. And after user expression.Replace(context, match), or something like that. Proble is I can't replace that "test" value. Anybody has any ideas?
Thank you.
|
|
|
|
|
Use group patterns.
Example:
Regex regex = new Regex( @"\sFrom\:[\s]+\""(?<from>(.)+)\""\s+To\:[\s]+\""(?<to>(.)+)\""\s+Subject\:[\s]+(?<subject>(.)+)Date\ s|\S)+\sBody\:[\s]+(?(.)+)\r\n");
Match match = regex.Match(message);
txtFrom.Text = match.Groups["from"].ToString();
txtTo.Text = match.Groups["to"].ToString();
txtSubject.Text = match.Groups["subject"].ToString();
txtBody.Text = match.Groups["body"].ToString();
|
|
|
|
|
Hello,
I got a c# app that controls a website through mshtml. I'm trying to execute a javascript that for some reason will not execute through the standard:
IHTMLWindow2 win = HTMLDoc.parentWindow;
win.execScript(theScript, "JScript");
I have found that if I manually enter the jscript into the IE address bar and hit GO, then it will run.
However I have tried the Navigate and the window.open(js) and these do not work either.
Any clues out there as to how one would insert a jscript into the IE address bar and click go through c#?
Help appreciated, thanks in advance!
PhrankBooth
|
|
|
|
|
have you tried RegisterClientScriptBlock?
|
|
|
|
|
|
You waited 6 hours 22 minutes and then you got sufficiently impatient that you posted again while your original post is still on the first page of the forum. We answer questions voluntarily so some patience would be nice.
hdv212 wrote: does any body can show me how to use Sql Transactions in DataRow ?
SqlTransaction is for transacting multiple queries on a SQL Server not the DataRow .
|
|
|
|
|
There are several apps across our company that need to access a WebService that is really a SQL Server 2005 SOAP endpoint. A domain service account was created for it so we wouldn't have to enable access for every single user. Initially, this user was setup as being allowed to logon to the server that SQL Server 2005 was running on. However, when we tried to access it, nothing worked. After monkeying around for a few days, in order to make it work we finally had to enable this service account logon priviledges to the computer calling the webservice. It turned out we didn't even need logon priviledges to the server.
This seems completely backwards to everyone here, and will be a real pain to administer if it is the case.
Here's some code that's similar to what we're doing to access it:
private DataSet GetInformation()
{
wsSQL service = new wsSQL();
service.Credentials = new NetworkCredentials("user", "pass");
return service.CallWebMethod();
}
The above code works only if the "user" has logon access to the local computer. From the looks of how this works, it's almost as if the NetworkCredentials uses the local computer to log onto the network, then passes those credentials on. Is this correct? If so, is there anyway to use the domain user to logon to the server and use those credentials?
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
Hi Guys,
Question please, how do you skip to a particular node on the tree when the tree loads?
Thanks in advance.
sasa
|
|
|
|
|
Have a guess. Go on... What do you think will select a particular node? Yup, it's SelectedNode
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.
|
|
|
|
|
What environment are you using? Windows, Web? You can't use Tree.SelectedNode = ???
only two letters away from being an asset
|
|
|
|