insert

INSERT with transaction and parameters?

Hello, I'm learning about VB.Net and need to work with an SQLite database using the open-source System.Data.SQLite ADO.Net solution The examples I found in the HOWTO section are only in C#. Would someone have a simple example in VB.Net that I could study to understand how to use transactions when INSERTing multiple parameters? FWIW, h...

insert data into sql database..

Dear Sir, I wrote code to insert textbox data into sql database, my code working properly but when I open the table no data was added, my code given below, help me... Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click Dim connetionString As String Dim connection As SqlConnecti...

PHP: saving multiple tuples to the same table

Hi all, I am trying to save data into the same table several times from the same $_POST array. You see, on my registration form a family is allowed to specify the names, gender and age of all members they wish to bring along. This data is being stored in a database table called aditional_member. Based on family size, I am dynamically ge...

What happens when using MySQL Insert Delayed inside a transaction?

Does the inserts are finished with the transaction commit? Or they can be finished later? ...

Memory allocation while insertion into a map

#include <stdio.h> #include <stdlib.h> #include <memory.h> #include <vector> #include <string> #include <iostream> #include <map> #include <utility> #include <algorithm> void * GetMemory(size_t n) { void *ptr = malloc(n); printf("getMem n %d ptr 0x%x\n", n, reinterpret_cast<unsigned int> (ptr)); return ptr; } void FreeMemory(vo...

Inserting into a Binary Tree which uses void* in C

I have to create a binary tree using the struct as follows: struct treenode; typedef struct treenode* TreeNode; struct treenode { void* data; TreeNode left, right; }; using void* as the type for the data to be stored at each leaf, so that an object of any type can be inserted into the tree. When I am inserting a new leaf, I have to...

insert and display image in vb.net from sql server database

i need to upload and display images to and from database. i have written this code for uploading and it uploads fine. except 1 problem. It crashes when i dont select an image. can someone help me fix it for null value? also how do you display an image in IE? code for inserting image - Dim imageInfo As FileInfo = Nothing Dim data() As B...

Django and "get() returned more than one Model name" error in multi-threaded program

Django's get_or_create function always cause "get() returned more than one Model name" error in a multi-threaded program. I even tried to put get_or_create statement inside a lock.acquire() and lock.release() block but still didn't work. The program only works when I set thread_count=1 The database is on InnoDB engine. How to fix this...

how to make the cursor get out of inserted html inserted through execCommand-insertHTML in firefox

I am testing on providing insert HTML option in WYSIWYG editor. I tried inserting div into the editor. After inserting IE seems to get the cursor out of the div this is what I want but FF the cursor is still in the div. How to make the cursor get out of the div? ...

after running insert or update query, need the last inserted record and compare in vb.net sql server

i have 2 queries in vb.net with an if clause - if x=0 then insert into table1 else update table1 both queries have 5 fields. now what i want to do is after this insert or update takes place, i need to look at this inserted/updated record and compare it with another table (table2). Especially for update, i have 5 fields in both tables. i...

entity framework inserting a many-to-many relationship between two existing objects while updating

I'm trying to do this: using(var context = new SampleEntities()) { User user = select a user from database; //Update user's properties user.Username = ... user.Website = ... //Add a role Role role = select a role from database //trying to insert into table UserRoles which has columns (UserID, Role...

Check if row already exists, if so tell the referenced table the id

Let's assume I have a table magazine: CREATE TABLE magazine ( magazine_id integer NOT NULL DEFAULT nextval(('public.magazine_magazine_id_seq'::text)::regclass), longname character varying(1000), shortname character varying(200), issn character varying(9), CONSTRAINT pk_magazine PRIMARY KEY (magazine_id) ); And another table ...

scope identity with linq

How do you a procedure like scope identity with linq want to use it in the TODO statement protected void btnAdd_Click(object sender, EventArgs e) { if (txtZip.Text != "" && txtAdd1.Text != "" && txtCity.Text != "") { TestDataClassDataContext dc = new TestDataClassDataContext(); Address add...

flex arraycollection - can i specify the size for an arraycollection?

Context: I use an ArrayCollection object as follows: 1) Number of elements is fixed. 2) Elements are inserted at a given position, based on some order. Question: Can I set the max size of the ArrayCollection? Will fixing the size improve the performance, as elements keep getting inserted into this collection? -Thank You ...

jQuery: Insert html from "title" tag into a "span" of a H2 tag

Hey guys, Say I had the following HTML: <h2>Heading <span></span></h2> <ul> <li><a href="#" title="I am wanting to be in H2!">Something</a></li> <li><a href="#" title="I too am wanting to be in H2!">Something else</a></li> </ul> I want to be able to take the title tag from the and place it inside the span of the h2. How can I do so?...

Slow select when inserting large amounts of data (MYSQL)

I have a process that imports a lot of data (950k rows) using inserts that insert 500 rows at a time. The process generally takes about 12 hours, which isn't too bad. Normally doing a query on the table is pretty quick (under 1 second) as I've put (what I think to be) the proper indexes in place. The problem I'm having is trying to run a...

SQL Server INSERT, Scope_Identity() and physical writing to disc

Hello everyone, I have a stored procedure that does, among other stuff, some inserts in different table inside a loop. See the example below for clearer understanding: INSERT INTO T1 VALUES ('something') SET @MyID = Scope_Identity() ... some stuff go here INSERT INTO T2 VALUES (@MyID, 'something else') ... The rest of the procedure...

SQL Server insert slow

Hi, I have two servers where I installed SQL Server 2008 Production: RAID 1 on SCSI disks Test: IDE disk When I try to execute a script with about 35.000 inserts, on the test server I need 30 sec and instead on the production server more than 2 min! Does anybody know why such difference? I mean, the DB are configured in the same way...

Run MySQL INSERT Query multiple times (insert values into multiple tables)

Hi, basically, I have 3 tables; users and projects, then I have 'users_projects' to allow the one-to-many formation. When a user adds a project, I need the project information stored and then the 'userid' and 'projectid' stored in the usersprojects table. It sounds like its really straight forward but I'm having problems with the syntax...

insert into select from in a table with identity column

Hi, I am using a insert into select from statement to insert the result set of a query into a table containing an identity column. I am consistently getting an error Cannot insert duplicate key row in object 'dbo.TABLE1' with unique index 'IX_TABLE1'. Please help ...