Problem In Insert Datas Et Into Database

Apr 18, 2008

Hi,

All.

For insert new entry...I used dataset and first all entry in dataset then i insert this dataset into datatabel of database.

For update edit entry....First i bind tabel to dataset then i update,delete in dataset then i insert dataset to database then there are problem that is there are once again entry of dataset to that tabel.

I also solved this problem by delete record which bind to dataset on save(insert )data set to database and then again insert dataset to tabel and solve it.

But if any other option for it then plz replay me

Thanks 

View 1 Replies


ADVERTISEMENT

Backup Table Datas, Test Script Then Restore Datas ?

Jul 20, 2004

Hi all,

I have to make many tests on datas i have in 2 specific tables.

My goal would be to backup datas somewhere to be able to restart from clean environment and tests many things with the same datas into my tables.

Could someone explain how to do it ?

thanks

Florent

View 3 Replies View Related

How To Import A Excel Datas To SQL Server Database

Apr 27, 2007

How to Import a Excel Datas to SQL Server Database

View 1 Replies View Related

Populating Datas From Sql Server Database And Displaying Them In CSV File Format Using C#

Dec 7, 2006

Hi
       I have to populate some datas from sql server database and display it directly in a CSV Format or CSV file. When i run the project it should provide me an option to whether open or save or cancel the file. when i click open it should be opened and be viewed in a excel sheet in CSV format and when i click save it should ask the destination folder and should be saved there in CSV format and when i click cancel it should be cancelled and the application should be closed. pls note that all these actions should happen in the same browser and should not be redirected to anyother page. Can anybody give me the detailed description and code in Asp.Net using C# .It's very Urgent.
RegardsVijay.

View 1 Replies View Related

How To Retrieve Datas From A SqlDataSource

Jan 11, 2006

Hi! I'm a novice in asp .net
I've a SqlDataSource component on an Aspx page.In the associated C# file, I would like to use datas from the query stored in the SqlDataSource component.How to do this?
Thanxs :)

View 2 Replies View Related

Importing Datas Into MS SQL Serveur

Apr 7, 2004

hello !

I am a student in a compagny because it´s my training. But, I must use MS SQL server and i don´t know at all this software !
I must import datas , which are in a ascii form, into MS SQL serveur 7,0.

Can you give me further information please, because it´s not easy at all !
thanks

View 1 Replies View Related

Get Datas Filtering By Only Month

Sep 14, 2006











Hello;

i want to get some results but only for one month. like that;



select * from News where PubDate = month(9)



i tried use between dates but i got errors because all of months aren't 30 or 31 days ... For example February is 28 days sometime.. So how can i get a month results...



thanks now for your helping ...

View 4 Replies View Related

Working With Big Size Datas?

Nov 1, 2007



Hello,
i am using sql server ce 2.0 for my device application.but this database sometimes gets corrupt,and i am not working with big size datas,if sdf file's size grow up,sdf file's performance gets knock out. for example: work with 50 mb data..what can i do?please somebody help me ?

View 1 Replies View Related

Merge Datas From Many Field

Nov 20, 2007



Hello All

Im Developing Windows application using VS2005 and SQL SERVER 2000.

I have a table with five columns


ID 1
Clm1 A_B
Clm2 A_C
Clm3 D_A
Clm4 B_C

What i want is

from Clm1 to Clm4
A,B,C is repeating

what is the query to get output as

CLm1 A
Clm2 B
Clm3 C
Clm4 D

the repeated datas should be taken unique data

How to do this
please help

Thanks in Advance

Ragards
Balagangadharan.R

View 4 Replies View Related

Importing Partials Datas From 2 Tables In Another One

Nov 12, 2005

I am having a problem to get all datas into one table
I must get datas from 2 other tables
datas from the first table are columns
but datas of the second table are rows

I cannot change the structure of TableA because an other application is using it as it is

TableA
num | value | key
1 | a | 1400
2 | b | 1401
3 | c | 1402
4 | d | 1403
...|... | 1403

TableB
key | name | descr | value
400 | john | ok | 451

TableC (the table where I want to insert datas from Table1 and Table2)

val1 | val2 | val3 | val4 |name | descr | value
1 | 2 | 3 |4 | john | ok | 451


TableA has thousands of rows and different numbers
I must get 8 different datas from TableA

so I get an horrible Query !

SELECT

TableB.name, TableB.descr, TableB.value,
TableA_1.value AS val1,
TableA_2.value AS val2,
TableA_3.value AS val3,
TableA_4.value AS val4,
TableA_5.value AS val5,
TableA_6.value AS val6,
TableA_7.value AS val7,
TableA_8.value AS val8

FROM dbo.TableB INNER JOIN
dbo.TableA_1 ON TableB.key = TableA_1.key INNER JOIN
dbo.TableA_2 ON TableB.key = TableA_2.key INNER JOIN
dbo.TableA_3 ON TableB.key = TableA_3.key INNER JOIN
dbo.TableA_4 ON TableB.key = TableA_4.key INNER JOIN
dbo.TableA_5 ON TableB.key = TableA_5.key INNER JOIN
dbo.TableA_6 ON TableB.key = TableA_6.key INNER JOIN
dbo.TableA_7 ON TableB.key = TableA_7.key INNER JOIN
dbo.TableA_8 ON TableB.key = TableA_8.key

WHERE TableA_1.num = 145
AND TableA_2.num = 80
AND TableA_3.num = 3160
AND TableA_4.num = 41
AND TableA_5.num = 50
AND TableA_6.num = 51
AND TableA_7.num = 53
AND TableA_8.num = 56


how can i do it in the best way ?

Thank you

View 3 Replies View Related

Call Report With Datas Updated

Oct 4, 2005

Hello,

View 4 Replies View Related

Inserting From Datas In One Table From Multiple Tables

Dec 5, 2007

Hi guys,I have a problem with my query. What i want to happen is to populate my table EV_NOTIFICATIONDETAILS (Docownerid, CurrentSentDate, LastSentDate, detailsID, GeneralRemarks) using the datas from the two different tables EV_NOTIFICATIONHEADER and EV_DOCDETAILS.I tried to create some a query but im having a error. The problem is once i insert the data from datas to the columns Docownerid, CurrentSentDate, LastSentDate the datas are stored in the database and when i tried to insert the remaining columns TO EV_NOTIFICATIONDETAILS detailsID, GeneralRemarks getting the datas from EV_DOCDETAIL it creates a new set of records in the database. Meaning it doesn't update the records in the table EV_NOTIFICATIONDETAILS but it creates a new set of records.here's my code:INSERT INTO EV_NOTIFICATIONDETAILS (Docownerid, CurrentNoticeSentDate, LastNoticeSentDate) SELECTDocownerid, CurrentSentDate, LastSentDateFROMEV_NOTIFICATIONHEADERINSERT INTO EV_NOTIFICATIONDETAILS (detailsID,GeneralRemarks) SELECTdetailsID,GeneralRemarksFROMEV_DOCDETAIL   Any ideas and suggestions will be greatly appreciated. 

View 2 Replies View Related

Replication Conflict Error.. How To Add Datas To Publisher ....

Aug 29, 2006

Hi..

I have configured publisher, distributer,subscriber... and tried to replicate it... it has done successfully...

When i try to add datas to the publisher ... it says

"conflict error"

can you please tell me how to check the replication is successfull or not.

and i want to add datas to publisher so that it should frequently updated in subscriber...

View 1 Replies View Related

Reporting Services - Exec SP Before Retrieving Datas

Jan 30, 2008

Hello,

I have a report in reporting services which has use many datasets.
Those datasets retrieve data from a same table.

Each Dataset use a store procedure.

In the first store procedure (associated to the first dataset), i call an another store procedure which fill the table.

My problem is that datasets haven't datas retrieved in the order of their position. So the third (for exemple) can begin retrieve data while the first store proc (called in the first dataset) is still running.
I had logging start/finish time of each SP and it appears that Dataset are retrieved in an asynchronous way.

Does anyone face the same problème. Is there a solution to execute an store procedure before retrieving data ?

Thank in advance for your help.
David

View 4 Replies View Related

Can I Insert/Update Large Text Field To Database Without Bulk Insert?

Nov 14, 2007

I have a web form with a text field that needs to take in as much as the user decides to type and insert it into an nvarchar(max) field in the database behind.  I've tried using the new .write() method in my update statement, but it cuts off the text after a while.  Is there a way to insert/update in SQL 2005 this without resorting to Bulk Insert? It bloats the transaction log and turning the logging off requires a call to sp_dboptions (or a straight-up ALTER DATABASE), which I'd like to avoid if I can.

View 6 Replies View Related

DB Design :: Buffer Database - Insert Information From Partners Then Make Update To Main Database

Oct 29, 2015

I actually work in an organisation and we have to find a solution about the data consistancy in the database. our partners use to send details to the organisation and inserted directly in the database, so we want to create a new database as a buffer database to insert informations from the partners then make an update to the main database. is there a better solution instead of that?

View 6 Replies View Related

Integration Services :: How To Insert / Update Table From Database 1 To Database 2

Oct 26, 2015

I am using two database server. Both are sql server. 

My task is :I want to insert data from server 1 table to server 2 table and update same when modified the existing data from server 1. is it possible to do the integration in single package.

I know to do insert and update seperately by ssis but need to do same with single task. 

View 5 Replies View Related

SQL Express Database Table Data Insert Into Another Database

Apr 15, 2007

Hi,

I have two SQL Express database and I want to do two things. One is to transfer a table over to the other database. Two, move the files from one table in one database to another. Please let me know when you get a chance.

Thanks,

Kyle

View 8 Replies View Related

Can Connect To Database, But How Do I Insert Values Into SQL Database?

Jun 14, 2006

I was able to connect to the SQL Database Pension with table clients with table values: ID, State, Name.'Create(connection)Dim conn As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)'open connectionconn.Open()However, I'm not sure how to insert a new row with an incremental ID number and a new State and Name.Sorry, I'm really new with VWD.

View 1 Replies View Related

How To Insert One Database Table To Another Database ?

May 22, 1999

Hi guys,

I have two sql servers one is Nt server another one is Nt workstation,i am able to admin from both sides.but i don't know how to insert/update one database table to another database table, pls. give me some ideas for this.

Thanks in Advance
Nellai

View 1 Replies View Related

How To Do Insert In Another Database When The Database Name Is A Variable

Mar 19, 2008

Hi,

We have different databases on the same server: Whrs001, Whrs002, etc. All databases have the same structure.

Suppose i have a table "location"
create table location
( location_id int not null primary key,
location_name varchar(50) not null )

I need to inserts data in "location" tables of different databases. But these inserts needs to be across databases. For example from the "Whrs003" database I need to insert data (location_id=123, location_name='markham') in "location" table of "Whrs001" database.

So my thinking is to defined a stored proc which has database name as an argument:
create procedure location_insert
@a_database_name varchar(100),
@a_location_id int,
@a_location_name varchar(50)
as
...

So for the above example the call will be :
exec location_insert 'Whrs001', 123, 'markham'


What would be the actual insert statement in this case? And what things i neeed to take care fo to make sure it always execute successfully?

Thanks

View 5 Replies View Related

Insert Data One Database To Other Database

May 7, 2007

hi

i am using this queries is

Insert into excelb.B.dbo.Emp(Employee_Name,Emp_addr) Values (@Employee_Name,@Emp_Addr) select * from excelb.A.dbo.Emp



excelb - server name

now my problem is a server to another server insert the data that not acces the data and i am using different password the servers- but same pasword are insert the data

plz help me



bye

elango

View 4 Replies View Related

Cannot INSERT INTO SQL Database.

Jul 17, 2006

I'm not sure what the problem is.  I am not getting any errors, but I can't get this code to insert into my SQL db.  I've checked the permissions on the database and table, and it looks fine. 
Is there something wrong with this code?  I'm trying to switch from VB to C#, so it's still new to me.  I've used the connection string in another APP so I know it works.
If I'm not getting an asp.net error, does that point to a problem with the DB?  Thanks.
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection Conn;SqlCommand Command;
Conn = new SqlConnection();Conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];Command = new SqlCommand();
Command.CommandText = "INSERT INTO [tbl_Test] ([test_name], [test_email]) VALUES (@test_name, @test_email)";
Command.CommandType = CommandType.Text;Command.Connection = Conn;Command.Parameters.Add("test_name", tbName.Text);Command.Parameters.Add("test_email", tbEmail.Text);
try
{
Command.Connection.Open();Command.ExecuteNonQuery();
}
catch (Exception ex)
{
lError.Text = ex.Message;
}
finally
{
Command.Connection.Close();pSubscribe.Visible = false;lThanks.Visible = true;
}

View 3 Replies View Related

How Do I Do A Look Up And Then Insert Into The Database,

Apr 10, 2008

Hi,
 I am getting xml data from a webservice.. and in that xml data there in field called State but on the system that we are getting the data from has a text box where the user can enter NC or North carolina.. But our system is set up to just accept a two letter character. like NC.. So suppose if the user sends North carolina instead of NC the nothing takes places on our system cause we get an error saying that Two many characters..
 
SO i am looking for ideas that will solve this problem but have the state column accept just 2 letters
any help will be appreciated
KAren

View 2 Replies View Related

Insert ' Into A Database

Jun 15, 2008

My problem is that when I add a question and the question contains a ' (For instance: I'm going to the store), an error message shows up for 'm from I'm. Here is my code.             SqlConnection myConnection = new SqlConnection("Server=???;Database=???;Persist Security Info=True;User ID=???;Password=???");            SqlCommand insertCmd = new SqlCommand();            insertCmd.CommandType = System.Data.CommandType.Text;            insertCmd.CommandText = "INSERT INTO TestQuestions (unitChapterID, question, answerA, answerB, answerC, answerD, answer) VALUES ("                + int.Parse(DropDownList3.Text.ToString()) + ", '"                + questionAddBox.Text.ToString() + "', '"                + aAddBox.Text.ToString() + "', '"                + bAddBox.Text.ToString() + "', '"                + cAddBox.Text.ToString() + "', '"                + dAddBox.Text.ToString() + "', '"                + answerAddBox.Text.ToString() + "')";            insertCmd.Connection = myConnection;            myConnection.Open();            insertCmd.ExecuteNonQuery();            myConnection.Close();

View 2 Replies View Related

Help Me Pls - With Database And Insert Statement

Aug 27, 2006

I Have an error:  Server Error in '/quanlythietbi' Application. INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_yeucau_nhanvien'. The conflict occurred in database 'equipment', table 'nhanvien', column 'manv'. The statement has been terminated. Source Error: Line 129:mycommand.Parameters.Add(new SqlParameter("@noidung_yc1",System.Data.SqlDbType.Text));
Line 130:mycommand.Parameters["@noidung_yc1"].Value = TextBox1.Text;
Line 131:int i = mycommand.ExecuteNonQuery();
Line 132:if (i>0)
Line 133:{and this is my code:string sqlstring = "Select * from yeucau where ngayGiaiQuyetxong='"+ Label8.Text +"' and date_yc='" + Label7.Text + "' and manv_yc='"+ TextBox2.Text + "' and noidung_yc='"+ TextBox1.Text+ "'";myconnection = new SqlConnection(stringconn);mycommand = new SqlCommand(sqlstring,myconnection);myconnection.Close();myconnection.Open();mycommand = new SqlCommand(insertquery,myconnection); mycommand.Parameters.Add(new SqlParameter("@ngayGiaiQuyetxong1",System.Data.SqlDbType.Char,10));mycommand.Parameters["@ngayGiaiQuyetxong1"].Value = Label8.Text;mycommand.Parameters.Add(new SqlParameter("@date_yc1",System.Data.SqlDbType.SmallDateTime));mycommand.Parameters["@date_yc1"].Value = Label7.Text;mycommand.Parameters.Add("@manv_yc1",System.Data.SqlDbType.Char,10);mycommand.Parameters["@manv_yc1"].Value = TextBox2.Text;mycommand.Parameters.Add(new SqlParameter("@noidung_yc1",System.Data.SqlDbType.Text));mycommand.Parameters["@noidung_yc1"].Value = TextBox1.Text;int i = mycommand.ExecuteNonQuery();if (i>0){lbcheck.Text = "Ä?ã Cập Nhật Yêu Cầu.";} --------------------------------------------------------------------------------------------------------------------------------I don't know what I must do to repair it :(

View 2 Replies View Related

Insert Data Into Database

Feb 27, 2007

What is wrong with this code the dropdowlist mainlyusing System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.SqlClient;public partial class NewAccount : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {    }    protected void NaccountButton_Click(object sender, EventArgs e)    {        if (Page.IsValid)        {            //Define data objects            SqlConnection conn;            SqlCommand comm;            //read from web config            string connectionString = ConfigurationManager.ConnectionStrings["OneBank"].ConnectionString;            //Initialize connection             conn = new SqlConnection(connectionString);            //create command            comm =new SqlCommand(                "INSERT INTO Customer (FirstName, LastName, Street, City, State," +                 "Zip, Phone, Payee,AccountType)" +                 "VALUES(FirstName, LastName, Street, City," +                 "State, Zip, Phone, Payee,AccountType)", conn);            //add parameters            comm.Parameters.Add("@FirstName", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@FirstName"].Value=Firstname.Text;            comm.Parameters.Add("@LastName", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@LastName"].Value=lastname.Text;            comm.Parameters.Add("@Street", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@Street"].Value=street.Text;            comm.Parameters.Add("@City", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@City"].Value=city.Text;            comm.Parameters.Add("@State", System.Data.SqlDbType.NVarChar, 50);            comm.Parameters["@State"].Value=state.Text;            comm.Parameters.Add("@Phone", System.Data.SqlDbType.Int);            comm.Parameters["@Phone"].Value=phone.Text;           comm.Parameters.Add("@AccountType", System.Data.SqlDbType.NVarChar, 50);           comm.Parameters["AccountType"].Value = dropdownlist1.SelectedValue.ToString();            //Enclose database in try catc finally            try            {                //open connection                conn.Open();                //execute the command                 comm.ExecuteNonQuery();                //reload query                Response.Redirect("NewAccount.aspx");            }            catch            {                //Display error               Errormessage.Text=                    "Error submitting request!";            }            finally            {                conn.Close();            }        }    }}
 
This is the table where thisis going
customer                       -------------                     customerID pk generated automatically firtsname                            lastname                             street                                                               city                                                                       statezipphoneaccountType

View 3 Replies View Related

Using Sql To Insert Into Database Problem

Oct 17, 2007

I am creating a zipcode search radius function for my site, and I downloaded a .sql file containing the info I need.
The problem is that on the latitude and longitude colunm it needs to be entered with a decimal such as 73.5598.
If the column type is Decimal I can manually enter it, but when it's inserted via the script it rounds the number ie. 73
The only type I can get to accept the .sql script as is, is nvarchar, but then it has trouble converting to a numeric for the radius.
This is the script I am entering:
INSERT INTO classifieds_ZipCodes (zip, city, state, state_name, longitude, latitude, rlong, rlat) VALUES ('00501', 'HOLTSVILLE', 'NY', 'New York', '73.0456', '40.8153', '1.27479232112', '0.712308900524') 
Any ideas??
Keep in mind there are over 42,000 zipcode entries
Thank you
Daniel Meis
 

View 4 Replies View Related

Programmatic Insert Into SQL Database

Nov 1, 2007

I have a page with over 20 Textbox and DDL controls and an upload  in various Divs and Panels (Ajax enabled) that are used for gathering user data. Some of the fields are mandatory and some optional.
In the Code behind (VB- I am a complete novice) On the submit button click event,  I iterate through the controls in the page and build an array with information from the controls that have data in them, (filtering out the non-filled textboxes, and DDLs).
All this works well, and I get an array called 'myInfo' with the columns with the control ID, and  control values 'rvalue' (as string), with the number of rows equal to the filled textboxes and DDLs.
I then step through the array and build a string with 'name=values' of all the rows in the myinfo array and email this as a message:
        ThisMessage = ""        NoOfControls = myInfo.GetLength(0)        For i = 0 To NoOfControls - 1                            ThisMessage = ThisMessage & myInfo(i).ID.ToString & "=" & myInfo(i).rvalue.ToString & "; "        Next
SendMail(email address, ThisMessage)
I also want to add this information to a database, appended by the IP address and datetime.now.
        Dim evdoDataSource As New SqlDataSource()        evdoDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("SQLConnectionStringCK").ToString        evdoDataSource.InsertCommandType = SqlDataSourceCommandType.Text        
        Dim InsertMessage As String = """INSERT INTO evdoData ("        NoOfControls = myInfo.GetLength(0)
        Dim k As Integer        For k = 0 To NoOfControls - 1                   InsertMessage = InsertMessage & myInfo(k).ID.ToString & ", "        Next
        InsertMessage = InsertMessage & "IPNo, DateEntered) VALUES ("
        For k = 0 To NoOfControls - 1                        InsertMessage = InsertMessage & "@" & myInfo(k).ID.ToString & ", "         Next        InsertMessage = InsertMessage & ", @IPNo, @DateEntered" & ")"""               evdoDataSource.InsertCommand = InsertMessage
I then similarly iterate through and do the insertparameters.
Now here is the rub- (My all too often DUH moment!)
When I look at the insertmessage in debug (and to be sure- I also show the insert string on a temporary debug label on the page), The insertmessage looks fine:
"INSERT INTO EvdData (FirstName, Age, Email, Phone, Country, City, IPNo, DateEntered) VALUES (@FirstName, @Age, @Email, @Phone, @Country, @City, , @IPNo, @DateEntered)"
However when the above code(evdoDataSource.InsertCommand = InsertMessage) is run, I get an error - the message with the error is:
The identifier that starts with 'INSERT INTO ModelData (FirstName, Age, Email, Phone, Country, City, IPNo, DateEntered) VALUES (@FirsteName, @Age, @Email, @Phone,' is too long. Maximum length is 128
EH?  When I actually copy the InsertMessage from the debug window and paste it manually after the command "evdoDataSource.InsertCommand = " It works, and I get the data inserted into the table..
-It would seem that I am probably missing something obvious in my complete "noviceness" . HELP! (oh and thanks a bunch in anticipation)
 _____________________________________________________________________________________________________________________
Its Easy --------------------------When you know How.  Meanwhile Aaaaaaaaah .

View 4 Replies View Related

Insert A Image Into A Sql Database

Nov 27, 2007

Hello All,
I want to insert a images into a database and these images save into a one perticular folder.
and i want to use these Images into some Diffrent Diffrent area
 
please help me
ashwani

View 1 Replies View Related

Insert Time To Database

Jan 31, 2008

Hello,
I have a textbox on my formview which brings in a time from an sqldatasource. The time is displayed as 09:00:00 in the sql select statement i have a convert function - CONVERT (varchar, Time, 8)
I am trying to alter the text e.g change to 09:30:00 and send it back to the database however i am having a lot of problems with that.
Anyone know what i have to do to sort this. I think it might be something to do with the sql insert or the insert parameters as i dont know how to change the time String back to DateTime.
Any help appreciated. Thanks in advance Mike.

View 1 Replies View Related

Insert Date Into SQL Database

Mar 4, 2008

This is a simple n00b question, but how can I insert the current date time into a datetime field in a database when submitting a form?
 I'm using the SQL DataSource control to do the inserting: <asp:SqlDataSource ID="SqlDataSourceMiguel" runat="server" ConnectionString="<%$ ConnectionStrings:SQLDataConnectionToInsertMiguelsTips %>"
 
InsertCommand="INSERT INTO tblMig(TipTitle, TipBody, TipExcerpt,TipDate) VALUES (@Title,@Body,@Excerpt,@varDate)">
<InsertParameters><asp:ControlParameter ControlID="ctl00$ContentPlaceHolder3$txtTitle" Name="Title" PropertyName="Text" /><asp:ControlParameter ControlID="ctl00$ContentPlaceHolder3$txtBody" Name="Body" PropertyName="Text" /><asp:ControlParameter ControlID="ctl00$ContentPlaceHolder3$txtExcerpt" Name="Excerpt" PropertyName="Text" /><asp:ControlParameter ControlID="ctl00$ContentPlaceHolder3$txtDateNow" Name="varDate" /></InsertParameters></asp:SqlDataSource>
 Thank You

View 4 Replies View Related

Insert Into, One-to-many Relationship Database

Apr 20, 2008

I have a MS-SQL 2005 database that is in a one-to-many relationship that is like this:
Table: Company
CompanyID, company name, address, city, etc.
Table Service States:
CompanyID, StateID
Table: States
CompanyID, StateID, State
The result is that you can have multiple states that are serviced assigned to any particular company.
Then in my ASP, I have a form for adding new companies to the database. On this form I have text boxes for Company name, Address, etc. Then for adding the states that are serviced, since you can have multiple states that serviced I decided to put in a Grid. This works fine if I'm editing the Company since the CompanyID already exists, but when I'm adding a new company, I can't INSERT INTO the Table Service States, since I don't know what the CompanyID is yet.
What would be the best way to handle this situation? I could probably put in a a ListBox with a Dropdown, then a little button with an add, add the items to the Listbox, then do an Insert on the Table Company, grab the companyID, then insert the items from the combobox.
I'm wonder if anyone has any better suggestions or ideas to handle this.
Thanks,
marly
 

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved