insert

Insert character at start of current line (vb.net)

Currently I have the code: textbox1.text = textbox1.text.insert(textbox1.getfirstcharIndexFromCurrentLine(),";") But this means it has to reload the entire textbox, which with large files is noticeable slow. What are the alternatives? ...

Checking if INSERT INTO statement was successful

I am using a MS Access database as the backend of my VB.NET application. I am entering users details into the database using an INSERT INTO statement: cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & config("DatabasePath") & ";") cn.Open() cmd = New OleDbCommand("INSERT INTO blah blah blah...", cn) dr = cmd.Ex...

Best Practice: How to Insert into Multiple Tables Through the Business Layer and Data Layer?

I USED to be a developer and part-time db designer, but it's been many years and I'm re-learning... I'm building a web app and have a Person (actually "Profile") table with a number of child tables which have N:N relationships with my Person table, e.g. FavoriteSports MusicalInstruments ArtisticSkills After reading through Scott ...

How do you insert or update many to many tables in .net entity framework

This seems like it should be quite obvious but something about the entity framework is confusing me and I cannot get this to work. Quite simply, I have three tables where the Id values are identity columns: Users (userId, username) Categories (categoryId, categoryName) JoinTable (UserId, CategoryId) composite. In the entities designe...

Adding an artificial row to an anonymous Linq resultset

I'm wondering what the best approach to adding an artificial row to an anonymous linq result set would be. I have a linq statement which uses "select new" to form the data required. Each record comes back as an anonymous object with ID and Name properties. However, I require that the first row of the data becomes an object with ID = NUL...

INSERT to a table with a sub query

Can I do this in SQL 2005? SELECT 'C'+inserted.exhid AS ExhId,inserted.exhname AS ExhName,inserted.exhid AS RefID INTO mytable FROM inserted WHERE inserted.altname IS NOT NULL It won't work if the table exists, but will create the table if it is non-existent. How do I get it to insert into an existing table? ...

Is there a way to allow paste from the clipboard using Shift-Insert on top of CTRL-V?

I know that you can use the context menu using a right-mouse-click in a control to choose to cut, copy, paste, etc. I've also noticed that you can use the windows keyboard shortcuts CTRL-C for Copy and CTRL-V for Paste. Windows supports native CTRL-Insert (for copy) and SHIFT-Insert (for paste). However, within Flex, it seems these do...

Converting '' to NULL in doctrine and symfony

Im using the symfony framework with mysql. I have a field in mysql that is generated by doctrine as: weight: { type: double, notnull: false, default: NULL } `weight` double(18,2) NULL DEFAULT NULL The value is entered using a textbox and the generated sql trys to insert '' into this field if no value is given. This produ...

.NET DataGrid Copy/Paste

I have a datagrid in C# Project. What I am trying to do is copy data from datagrid and then paste in file. Then edit content and insert back to datagrid from clipboard. I can copy data from datagrid into clipboard but I can not insert/replace text from clipboard into datagrid. How can I insert data from clipboard into datagrid? Sample...

How to insert an excel chart into Word using AddOLEObject

I'm trying to create a linked OLE Object in a Word document using VB.Net. Existing code uses InlineShapes.AddOLEObject(FileName:="abc.xlsx", LinkToFile:=True, Range:=Some Word Range) to insert a worksheet into a Word document. I need more control than this. To select a range of cells I've found that extra information after the filename...

MySQL insert multiple fixed length values manually

Hi there, I want to insert multiple values in a table where the value in one of the column increments sequentially. However, the sequence is a bit complex because of business requirements. The single insert would go something like this: INSERT INTO blah (col1, col2) VALUES ('SU0001', 'myemail'); Now, col1 is the value that needs to ...

JavaFX: Appending line to path as animation

Hi, I am trying to create an animated chart which grows to the right as new data is added. I'm using a path for plotting the variables (JavaFX LineChart seems too slow), attempting to plot a new variable every 500ms by appending a new LineTo to the set of path elements. I have reduced the problem down to the following sample code. Could...

Why can't I do this INSERT in MYSQL? (Python MySQLdb)

This is a follow up to this question I asked earlier: http://stackoverflow.com/questions/2267034/why-cant-i-insert-into-mysql/2267076#2267076 That question solved it partly. Now I'm doing it in Python and it's not working :( cursor.execute("INSERT INTO life(user_id, utm) values(%s,PointFromWKB(point(%s,%s)))",the_user_id, utm_easting,...

Multiple unique counters in a table

Hi all, I have a problem where I need to keep and increment an object number field in a table, however this number should be unique within given logical domain, not across table globally. An example would be multiple Businesses scheduling multiple Jobs; Job.Number should be unique within a business. So I basically need to make sure t...

Which is faster, EXISTS before or after the INSERT?

I have an SP in SQL Server which runs hundreds of times a minute, and needs to check incoming traffic against a database. At the moment it does the following INSERT INTO table SELECT @value1,@value2 WHERE NOT EXISTS (SELECT * FROM table WHERE value1 = @value1 AND value2 = @value2); However, I could also go with IF NOT EXISTS(SELECT...

Inserting into a Access DB with an AutoNumber PK and getting an Insert syntax error

I am trying to insert into a access db and the PK is an autonumber that is generated by the DB. I am getting a syntax error for the insert statement and dont know why. If possible I would like to return the autonumber value in the same statement. Here is what I got so far. Dim cn As OleDbConnection Dim cmd As OleDbCommand D...

When exactly are PHP-MySQL variable assignments made?

[Status: learner] Using checkboxes, the user selects rows from a displayed HTML table. I then want to insert the date and the unique row id ("select_id") of the selected ('ticked') rows into a different table. Maybe I'm off-base, but it seems to me that the first block of code does not work. The second block of code does work. If I'...

sql conditional insert if row doesn't already exist

I'm creating a sproc that will insert rows into a 'staging' table with an insert into + subquery like so: INSERT INTO myStagingTable SELECT col1, col2, col3 FROM myRealTable I need to put a conditional in there somehow to determine if the value from col1 for example already exists on myStagingTable, then don't insert it, just skip tha...

N-Insert In Sed

How would I replace the first 150 characters of every line with spaces using sed. I don't want to bring out the big guns (Python, Perl, etc) and it seems like sed is pretty powerful in itself (some people have written the dc calculator in it for example). A related problem is inserting 150 spaces in front of every line. s/^.\{50\}/?????...

Insert an element in sorted and rotated list

A list of sorted and rotated element is given. Elements are either sorted in ascending or descending order. For example - I've list of sorted elements as follows 10,12,14,16,18,20,51,53,54,59 Now this list is rotated by X number of times and then it looks as follows. 51,53,54,59,10,12,14,16,18,20 If you want to insert an element in...