ChrisHunter 152 Posting Whiz in Training Featured Poster

You can create a table type in SQL server 2008 onwards which can be used to pass a data table into a stored procedure which should take up less resources and time than executing the stored proc for each row you need to update. I tried to use them in 2005 but creating types was only introduced in 2008. Have a look at the links below about creating types in SQL server:

http://blog.sqlauthority.com/2008/08/31/sql-server-table-valued-parameters-in-sql-server-2008/

http://msdn.microsoft.com/en-us/library/ms175007.aspx

ChrisHunter 152 Posting Whiz in Training Featured Poster

There's a massive amount of tutorials out there that cover what you need to do.

Have a look at these links to:

Insert new record.

Update an existing record.

Delete and existing record.

In the future you need to show us what you have done so we know you have attempted it yourself because the DaniWeb rules state that we can't do you're work for you but only help you and give you advice.

Good luck and let me know if you get stuck.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Happy Birthday <Michael>... but where's your birthday bunny?

Mine is 14th July and on that day:

  • Billy The Kid was shot.
  • The French revolution.
  • Capital punishment is abolished in Canada.
ChrisHunter 152 Posting Whiz in Training Featured Poster

You need to be less vague about what you want to do. Do you want to insert net data, update existing data, delete data? What have you tried so far to solve the problem? and by that I mean what have you done other than create the table.

I will try to help you but I need to know what it is you actually want and see what you have already tried before I can

ChrisHunter 152 Posting Whiz in Training Featured Poster

Post the SaveChanges() method. What error did you get?

ChrisHunter 152 Posting Whiz in Training Featured Poster

and the transaction statements like the delete, update and insert?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Can you post the SQL statements you were using please?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Hi Sharan7081, welcome to DaniWeb.

DaniWeb users are more than happy to help you with any problems you might have, given that you can provide evidence that you've attempted to solve the problem youself and aren't just looking for someone to do the work for. (I think that might be why you have a down vote).

Having said that it sounds like you don't know where to start with this, so although I'm not going to give you the code I'll happily give you some ideas of what you need to do.

You can configure a DataGridView so that particular columns can be textBox columns, comboBox columns, checkBox columns as well as other types. Once you have chosen the type of column you want, using them is just like using a regular comboBox or textBox control (once you've accessed it through the DataGridViews columns property.

Here are a few links that might be of use to you:

DataGridViewComboBoxColumn class

DataGridViewComboBoxColumn DataSource

DataGrivViewTextBoxColumn class

Hope this helps and good luck.

ddanbe commented: Very helpfull! +14
ChrisHunter 152 Posting Whiz in Training Featured Poster

My hard drive died ages ago and I havent put my music back on the new one, I just listen to music on 8tracks or YouTube.

Jack Johnson, Ben Howard, King Charles, Mumford and Sons, Eletric Swing and a bit of Funky House, old school HipHop or something with horrible bass are all I listen to right now and it's all streamable on the net!.

ChrisHunter 152 Posting Whiz in Training Featured Poster

As Ketsuekiame said if you're invoice is alph-numeric (letters and numbers) you can't parse it into an int.

Try taking the int.parse and .ToString() off the first line and adding (int)before the name dataGridView2 (that will also only work if the cell doesn't contain letters but it means you're not converting it to a string before trying to store it in an int).

ChrisHunter 152 Posting Whiz in Training Featured Poster

Which ever language you're strongest in. Out of VB and C++ I'd sat C++.

C# wouldn't be too hard for you to pick up if you're looking for a new language and it's widely used so theres plenty of resources available.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Have a look at this, this, this and that.

Google is amazing !

ChrisHunter 152 Posting Whiz in Training Featured Poster

I did mention that a few posts ago, if you put' ' around something it is taken as a string value, I've been caught out by that problem a few times in the past.

You're welcome, I'm glad you managed to solve the problem.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Yeah but you're TV lisence pays for the little VT's like the one of hippos swimming around which. I'm sure one of those cose £10,000 to make. I'd rather do without and have a cheaper TV lisence tbh.

ChrisHunter 152 Posting Whiz in Training Featured Poster

So where is it giving you the error and what does the error say?

I'm an Sql Serever developer so my knowlage of Access is limited I'm affraid but I'll still try to help if I can.

ChrisHunter 152 Posting Whiz in Training Featured Poster

try Convet.ToInt64(dataGridView2.SelectedCells[0].Value) and see what happens.

Let me know how you get on.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Is cashID an int value?

If cashID is an int do cashID = " + (int)dataGridView2.SelectedCells[0].Value + "";

In the long run the best thing to do is to creats a stored procedures on the database side, it will help prevent the SQL statements from being changed while you're editing you app.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I tried to do something similar for an SQL Server 2005 project i'm working on but realised creating types (which would solve my problem) wasn't introduced untill the 2008 version.

Take a look at these links:

Link 1

Link 2

ChrisHunter 152 Posting Whiz in Training Featured Poster

Have you tried looping through the array and executing the procedure for each index in the array?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Take a look at these links:

http://social.msdn.microsoft.com/Forums/zh/sqlsetupandupgrade/thread/f5847d66-6d17-4a17-ac9f-7f0cdc18002d

http://support.microsoft.com/kb/888228

All I did was copy and paste the error into Google so if the above links don't help there Google it again and you might be able to find a solution.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Not a problem, glad I could help.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Same as the SELECT statement, the WHERE clause should be done on the unique identifier column (primary key/ ID column)

You should know the ID of the record as it should be returned as part of the SELECT statement something like: WHERE ID = myID.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Oh sorry, it looks like you've got your INSERT statements and UPDATE mixed together, for an INSERT you do something like:

INSERT INTO myTable (Name, Adddress, DOB) VALUES ('" + nameTextBox1.Text + "', '" + addressTextBox.Text + "', '" + dateOfBirthTextBox.Text + "')

But for an UPDATE you do something like:

UPDATE myTable Set Name = '" + nameTextBox1.Text + "', Address = '" + addressTextBox.Text + "', DOB = '" + dateOfBirthTextBox.Text + "'";

You need a where clause too if you want to update a specific record and not all of them.

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

put the word set after the table name see if that works.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Can you post the error you're getting?

I'm pretty sure connection string is wrong for a start, have a look at this

ChrisHunter 152 Posting Whiz in Training Featured Poster

I heard a good'en when someone on the radio was asked the difference between rugby and football, "Football is pretending to be injured for 90 minutes. Rugby is pretending you're NOT injured for 80 minutes".

If you don't agree with that you've either never heard of the Warrington Wolves player who ruptured a testicle and carried on playing for 20 minutes untill he was forced to come off, or you're a football player. . .

You can read the story here. The best part is he tweeted "Just coming out the hospital to go home... Seriously feel like I've left something?".

Englad all the way!

ChrisHunter 152 Posting Whiz in Training Featured Poster

Watched "The Raid" at the weekend. Not the best film in the world and it's really about the pure violence than it is the story but I loved it, makes me want to take up some sort of martial arts.

Act of Valor is next on my watch list.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Have you set the HeaderCell property for the DGV to true?

dataGridView1.Columns["CashAccRef"].HeaderCell.Visible = true;

ChrisHunter 152 Posting Whiz in Training Featured Poster

Only just stumbled on this thread and it made me laugh. slow day that day by any chance diafol? The mental image of a bird spinning in space made me laugh too.

ChrisHunter 152 Posting Whiz in Training Featured Poster

ddanbe's suggestion works well I use it at the moment, plus if it stays are a DT format when you store it in a string it's easily converted back to DT type.

ddanbe commented: Well said! :) +14
ChrisHunter 152 Posting Whiz in Training Featured Poster

I have yet to see a single person on FOX News who deserves to be considered an "expert" in anything. If anything they are just story-tellers who pretend their stories have some semblance of truth.

Couldn't agree more! Joan River and Kelly Osbourn are fashion poliece . . . says it all !

I only know this because my partner watches E! . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

OHHHHHHH he went there !

ChrisHunter 152 Posting Whiz in Training Featured Poster

Fair enough, thanks.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I don't know if this has been raised before or if the folder images on the left of the main page are supposed to do this but I clicked on the folder image to the left of "C#" and the folder turned grey but didn't take me to the C# section.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Unless it was just a typo when you were posting you have a closed the speach marks too early in your SQL statement. It needs to be at the end of the statement instead of after emp_surname.

ChrisHunter 152 Posting Whiz in Training Featured Poster

You're very welcome.

I don't quite understand you new request. At the moment you select everything from table1 if the name contains the value entered by the user (lets use "James" as an example again), you only want to return the Name field and NOT the entire record?

If that is the case, when you do "SELECT *" it means SELECT ALL columns (the entire row). If you want to select individual column you have to replace the * with the name of the column you want to select (which in your case is "Name".

Here are a few links that you might find useful:

http://www.w3schools.com/sql/sql_select.asp

http://beginner-sql-tutorial.com/sql.htm

If you get stuck try researching what you're trying to do and it might save you a lot of time as it's more than likely that someone has had the same problem in the past.

However if you can't find a solution feel free to ask but make sure you show what you've done so far as DaniWeb rules mean we can't do your work for you.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Ohhhh do you want the user to select a the name of a field within Table1, from the comboBox, and then use what they have entered into the textBox as the search criteria?

If so try something like: "SELECT * FROM Table1 WHERE " + comboBox1.SelectedItem.ToString() + " LIKE '%" + textBox1.Text + "%'";

So if "Name" is selected from the comboBox and "James" is entered in the textBox then the statement above would select all records from Table that contain "James" their Name field.

Is this what you're looking for?

ChrisHunter 152 Posting Whiz in Training Featured Poster

You didn't, the bit you added at the top should look like this:

string parameter = textbox1.Text + comboBox.SelectedText.ToString();

NOT like this:

text_searchstring + comboBox1.SelectedItem.ToString();

and you SQL statement should look like this:

"select * from Table1 where Name like '%" + parameter + "%'"

NOT like this

"select * from Table1 where Name like '%" + text_searchstring.Text + "%'"

Have another go and let me know what happens.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I don't understand what you're asking. can you post the mouse click method as it is when you get that error for me to have a look at please?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Try doing something like string parameter = textbox1.Text + comboBox.SelectedText.ToString(); at the top of the the button click method and then use that parameter variable as the parameter in the SQL statement.

Let me know how you get on.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Went to see Zero Dark thirty on the weekend and I thought it was really good. It wasn't just shooting and killing its actually more about the woman who found, how she changed over the course of the search and the sacrafices people made to get to that end point.

ChrisHunter 152 Posting Whiz in Training Featured Poster

The riots in 2011 and prior to this say a lot about the English subculture and the levels they will sink to.

@BigPaw - as someone mentioned above, the majority of the population were disgusted with what was happening

Also there are many different places to prey to which ever god you please. Just because you don't see people walking around with obvious signs of their religions doesn't mean that England doesn't have a diverse range of religions practising.

To get to the point:

  • I've got to admit the food is VERY processed and I try to cook with fresh food as often as possible but there's nothing like a filthy burger every not and again.

  • Welsh is a completely differnt language to English (Welsh for microwave is popty-ping (i think)).

  • I'm one of those English people who didn't learn another language at school which I do regret and I aim to learn as much French as possible by 2014.

  • All too often people tar England (and all of Britan for that matter) with the same brush because of all the negative stories in the news because they shock us more than good news ever will.

As with any country England has it's flaws but people come here for a reason and it can't be the weather or the food.

Now can we please get back to the point of Manners, chivalry and sexism in general please?

ChrisHunter 152 Posting Whiz in Training Featured Poster

You shouldn't use Wikipedia to back up and argument or in research, it can be edited by anyone so it's unreliable.

ChrisHunter 152 Posting Whiz in Training Featured Poster

You're more than welcome.

What was the issuse in the end?

ChrisHunter 152 Posting Whiz in Training Featured Poster

What it looks like you were orignally doing is putting the second picturebox over the first without setting it's visible property to false, meaning you can't see the first picturebox through the second. Set the visible property of both pictureboxes to false by default and then set them to true in turn.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Sorry my last post was quite off topic.

I have a relative who lives in Florida and she doesn't like coming to England because people rarely apologise when they bump into you and are generally rude.

Living in the north west of England and having been to Florida a number of times I couldn't agree more, I can't wait to go again later this year.

ChrisHunter 152 Posting Whiz in Training Featured Poster

No, explain your problem more, do you get an error? is the image transparent? is the image white? is it just a case of once the second image shows you can't see the first image anymore?.

If the latter is the case then replace the zeros in the g.DrawImage with other numbers as they are what sets the location of the image on the screen.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Slavery and psychology? It might have been the case in the past but whether you agree with it or not England is one of the most multicultural countries and accepting of all religions and races.

You only have to take a walk around London, Mancester or even liverpool to see that.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Al Murray is just his comedic character, he's actually a well spoken and educated fella, completely different to the character he plays, as is the man that plays Frank Gallagher in the orignal Shameless series is the.

It's all about manners, politeness and respect, which you don't see enough of from the majority of generations these days (more so teenagers and people in their early 20's in the uk).

Whether you're male or female I'll still hold the door open for you. However I will only offer my seat to men or women that are less sterdy on their feet than me (be it due to their age, a disability or just a broken limb), or woman that are pregnant due to the fact that if they fall over the result may be a lot worse than if I were to fall over.

Some people might disagree and say I could just as easily hurt myself were as any of the abouve may just burse but the fact is I would rather avoid the possibliity of that happening to someone else.

If I think you look fit and healthy enough to stand though I'm not giving up my seat :P.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Check the file path for your first image is correct. As far as I can see thats the only thing that might be causing the problem.