|
create a relation between the two tables?
|
|
|
|
|
hi...
i have used datarelation but i am not sure how to get that common data into one single table...can you give me some code for that.
Thank You.
|
|
|
|
|
I guess the straight forward way would be to loop through one table and for each row copy its data and all the related rows into the new table.
|
|
|
|
|
I get http://www.postimage.org/image.php?v=Pq1N1qmr[^] <- this error on one of the computers.
Dont know why.
this is the code:
try
{
label12.ForeColor = Color.Black;
string dbConnComm = "INSERT INTO Vnosi ([Dostava],[Skatla],[Barkoda],[Oznaka],[Skener],[Operater],[Datum],[PosnetkiV3],[PosnetkiM3],[Opombe]) VALUES ("
+ cmbDostava.Text + ", "
+ cmbSkatla.Text + ", '"
+ cmbBarkoda.Text + "', '"
+ cmbEnota.Text + "', '"
+ cmbSkener.Text + "', '"
+ cmbOperater.Text + "', '"
+ cmbDatum.Text + "', "
+ txtVA3.Text + ", "
+ txtMA3.Text + ", '"
+ txtOpombe.Text + "')";
SqlConnection dbConn = new SqlConnection(sqlConnection);
dbConn.Open();
SqlCommand dbComm = new SqlCommand(dbConnComm, dbConn);
dbComm.ExecuteNonQuery();
dbConn.Close();
label12.Text = "Uspešno vnešeno";
}
catch(Exception ex)
{
label12.ForeColor = Color.Red;
label12.Text = "Napaka pri vnosu";
MessageBox.Show("Napaka: " + ex.ToString());
}
PC has framework 2.0 and 1.1
|
|
|
|
|
A few quick question to help try find the answer.
Have you tried the insert into the database directly and dose it work?
What is the connection string you are using as it appears to be a connection issue?
Can you connect to the database from that machine?
Why are you using an insert? you should look at using a stored procedure as direct sql asks for an injection attack.
|
|
|
|
|
|
Yes Giorgi, thank you for your information on security about SQL injections.
I just needed an anwser which was more than funny. The SQL Connection string was wrong.
And its my bad that i forgot to mention that this error occurs only on computers which have low-access accounts in our domain. Now i've fixed this and it works.
HopingToCode was right. I should check the connection string. Which i did today.
Thank you both for your time.
Regards,
Matjaž
|
|
|
|
|
I am not able to attach Application.Idle event with the event handler. what will be the reasons??
thanks
|
|
|
|
|
saksp wrote: what will be the reasons
Maybe you're doing it wrong?
This works for me.
using System;
using System.Windows.Forms;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Application.Idle += new EventHandler(Application_Idle);
}
void Application_Idle(object sender, EventArgs e)
{
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
saksp wrote: I am not able to attach Application.Idle event with the event handler. what will be the reasons??
You're doing it wrong.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all,
On VS2005, I've add a background image on a form, fine. But when I added a label cannot see the image through it. How can I see the image through the label?
Thanks a lot.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Make the background color of the label transparent ? The other way is to draw the text on the form yourself.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
CodingLover wrote: How can I see the image through the label?
set the Backcolor for the label to: Transparent
label.Backcolor = Transparent
|
|
|
|
|
You set the label to transparent, However be aware that there is no true transparency in .net which means that transparent shows the background image and not the image underneathe.
|
|
|
|
|
I am using AxWebBrowser control on windows form. I want to handle the shortcut paste(ctrl + V) event so that i can excute my own customised function to perform this operation.
I tried this as following:
private void editorWebBrowser_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyData == (Keys)Shortcut.CtrlV)
{
MyTextPasteFunction();
}
base.OnPreviewKeyDown(e);
}
But it is not stopping executing it's default paste event. So Ctrl + V is pasting the contents twice.
What should i do to stop the default paste event execution?
Thanks in Advance.
|
|
|
|
|
You could always inject an onpaste handler in the webpage immediately after it has been loaded.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
To elaborate further ,i am working on Content management system and I have embedded the AxWebBrowserControl on Windows form.
|
|
|
|
|
When the web page has finished loading, you could inject some javascript into the page that handled the onpaste function.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
I am working on content management system and the axwerbbrowser is nothing but HTML editor control
|
|
|
|
|
So, create a minimal webpage with the onpaste function already in it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
I am doing an update to my database after adding a row to the data table. The TableAdapter uses the VS2005 generated INSERT command (the table has a lot of columns). The line is...
DishVarTA.Update(CurrentStDishVarRow);
where 'CurrentStDishVarRow' points to the row in the 'Added' state.
My problem is that I want to use the row data after this statement to format and send off to some machinery. After the Update however 'CurrentStDishVarRow' points to an entirely different row.
I think the INSERT statement in the TableAdapter is putting the new row in at the beginning of the table so the row indexing changes.
Is there any way I could preserve the pointer, or is the only way to fill the table again and/or find it again?
Done a lot of searching and haven't found much that covers this, does that mean preserving row pointers across updates is not 'de rigeur'?
Thanks,
|
|
|
|
|
jrgrobinson wrote: DishVarTA.Update(CurrentStDishVarRow);
This code will attempts to save changes in the indicated DataRow to the database.
You can store the row before updating and then manipulate the new instance of required row.
now to locate the row in the datatable before calling the update method for the dataadapter use one of this methods:
<br />
string s = "primaryKeyValue";<br />
DataRow foundRow = datatable.Rows.Find(s);
<br />
DataRow[] foundRows;<br />
foundRows = datatable.Select("put filter expression ");
|
|
|
|
|
Thanks. Just a simple question, after the update, could I assume the rows are all still in the TableAdapter and do the Find or Select then?
Thanks
|
|
|
|
|
TableAdapter don't store any rows, it just provide communication between your application and a database.
try to read this article to get more info:http://msdn.microsoft.com/en-us/library/bz9tthwx(VS.80).aspx[^]
The Datatable represents one table of data, so you should depend on the datatable to use the find or select methods.
Like what you do if you can't do what you like
|
|
|
|
|
You are using the built in wizard thingys to do your data processing and now you want to do something slightly different to the STANDARD methedology, like post processing after an insert. This is why they are a POS, I strongly suggest you read up on Data Access Layer and rework all your data processing.
As that is probably going to frighten the day lights out of you (as it would most people) try and capture the row information prior to saving back to the database (take a copy/clone of CurrentStDishVarRow ) and see if you can work with that.
Never underestimate the power of human stupidity
RAH
|
|
|
|