Inserting Data To Text File From Database And Inserting Data Back To Database From Text File

Aug 7, 2007

Hello friends....

I am looking for 2 things(using c#.net or vb.net and sql svr 2000)

1.convert data from sql server 2000 database (say customers table from northwinds database) to a text file(separated by commas or just plain space)


2.Insert the data from text file back to database.


Can someone pls give me the detailed code to achieve this....really need this on urgent basis.......Thank You.

View 10 Replies


ADVERTISEMENT

Inserting Data From Text File

Jul 22, 1998

If this is the wrong place for this question, would someone please tell me so. I am new to SQL Server and still feeling out resources. I have a few books on SQL Server but none cover this question.

I have a text file of dates and numbers that I want to insert into a table. There are way too many rows of data in the file to do this by hand.

Question == How can I essentially insert the text file into my table?

Thank you,
Doug

View 2 Replies View Related

Inserting Data From Text File To SQL ME Table

Nov 24, 2006

Hello,

I have an application taht requires the use of a table. The device that this application works on, has a local memory that does not allow me to insert the 800,000 records that I need. Therefore I have two approaches:

1. To insert less records into my local memory database e.g 40,000 but not row by row, bulk insert is better. How do I do the bulk insert?

2. This is the most prefferable way: To find a way to insert all 800,000 records into a table on the storage card which is 1GB. What do you suggest? Will using threads be helpfull? Any ideas?

I use C# from VS 2005, SQL ME, compact framework 2.0 and windows 4.2.

Thanks in advance,

John.

View 6 Replies View Related

Integration Services :: Inserting Data Into Tables From Text File By Having Certain Condition

Nov 8, 2015

I have a text file which has rows 7 rows.I want to insert the data into SQL table using ssis In text file we have a  column which has values as Y or N...I wanted to take only those rows which are Y...But we have only 6 rows in SQL table.It does not have the column with Y or N.

View 2 Replies View Related

Parsing Text File And Inserting Into DB

Mar 19, 2008

Hello all,
I have a question regarding importing text file data into SQL Server.  I'm hoping someone can point me in the right direction, as my searches haven't turned up anything specific enough.
I'm trying to parse a large (24MB) text file.  It's a fixed-width file, with multiple columns.  I need to parse this file, check if a record already exists, and then import the data into the database.  But I don't need to insert every column.  There's only a few columns from the file I need to insert.  This parsing also needs to occur at regular intervals (daily).
I looked at BULK INSERT, but I can't find an example that uses only some of the columns.  Every example uses all columns, and the file is delimited, not fixed-width.
Is there anything within SQL Server that can accomplish this?  I haven't turned up anything that will solve my problem.  The only other solution I can think of is an application that parses the file for me and inserts the data into the database.  But can I schedule that application to run every night at midnight (for example) through SQL Server?
I'm not too familiar with SQL Server, so I appreciate any help offered.
Thanks,Jay

View 7 Replies View Related

4 Layered Web Application For Inserting Data Into A Database Using Sql Server As The Back End And A Web Form As The Front End Using C#

Dec 10, 2005

4 Layered Web Application for Inserting data into a database using sql server as the back end and a web form as the front end using C# .
Can someone provide with code as I am new to this architecture and framework.
Better send email.
Thanks In Advance,
A New Bie

View 1 Replies View Related

Reading Data From Text File Database

Jun 6, 2007

 Hi everyone I have a directory that contains a lot of text files that have data I need to draw from.  I want to know if it is possible to write a program that will read all of the text files in the directory and pull out data and save it to a new textfile. For example: Each text file is formatted this wayColumn1, Column2, Column3"1","xxxx","yyyy""2", "xxxx", "yyyy""3", "XXXX", "yyyy" I want to put all lines that begin with 1 in one text file, all the lines that begin with two in another text file, and the same with all lines that begin with 3. my problem is I want to be able to point at the folder that contains those files and have it read every text file in the folder and perform the operation.  If this is possible can someone point me in the right direction on how to get started.Thank you for any help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 

View 1 Replies View Related

Export Data From SQL Database Table To Text File

Jun 22, 2001

Hi,

I'm trying to export data from one of the table in my SQL 7.0 database into text file. Can someone tell me how can i do this using SQL Query instead of using BCP (command line) ?? Thank you in advance.

View 4 Replies View Related

How To Transfer Data From Multiple Text File In To A Database Using SSIS

Mar 20, 2008

Hi All,
 i have mutiple text file. let us say,a1.txtb1.txtc1.txt
i have to port this text file data into the table (SqlServer Database) which have the same file structure.(i.e)x1 (SqlServer table)y2 (SqlServer table)z3 (SqlServer table)
now i have to transfer a1.txt file data ----to---  x1b1.txt file data ----to---  y2c1.txt file data ----to---  z3
using SSIS. like that, i have to transfer more than 250 files at a time.manually binding 250 files into the package is very cumbersome and time consuming process.
so, can any one give ur valuable sugession to solve this issue.
 

View 2 Replies View Related

DTS Issue -- Dtsrun Can't Find My Text File That I'm Inserting Into My Sql Table

Apr 21, 2005

Here is the error message that I'm getting
   Error string:  Error opening datafile: The system cannot find the path specified.
The file it's bombing out on is the text file that Im importing into one of my tables through a dts package (which is getting called by the dtsrun statement -- that is giving off this message.)  If anyone would know what may be sending this message off to me let me know.
Thanks in advance.
RB
 

View 2 Replies View Related

Inserting A Control Record Into A Flat Text File Through SSIS

May 2, 2006

I am working on an SSIS project where I create two flat files for submission to a data contractor. This contractor requires a control record be the first line in the file. I create the control record based on the table information being exported.

What I would like to know is, is it possible to utilize the Header Section of the Flat File Destination Editor to insert the control record? And, as it is dynamic, what kind of coding must I do in order to utlise this functionality?

Thanks.

View 4 Replies View Related

Inserting Data From A DB Into A Text Field

Jun 2, 2008

Hello Everyone,
 
I have looked and looked for any information on how to insert data from a db into a text field using a stored procedure.  If anyone has any helpful links or suggestions, my sanity would greatly appreciate the help.
 
Thank you

View 1 Replies View Related

Inserting The Data Into Text Data Type

Jan 22, 2001

Hi everybody,

In our datbase we have a table with text data type.Help me if anybody knows how to insert text data into text data type of sql server.

i am able to modify and retrive but i am not able to insert text. please if u have idea, please give me reply asap.

Thanks,
Giri

View 1 Replies View Related

Inserting Text Into SQL 2005 Database Padded With Spaces

Jan 2, 2007

I have a Detailsview with Insert and Update options connected to a SQL 2005 table with templated textboxes for input. The textboxes have maxlength set to the number of characters in each respective field in the SQL 2005 table. When text is inserted it gets padded with spaces if all the field length is not used. When you try to edit the field the cursor does not move because of the padded spaces. The End key must be pressed to find the end of the string and the padded space removed before adding edited text. I am working in VB.net. If I check the field in SQL Studio Express is shows the text I typed plus blank space for the remainder of the field.
My question is how can I add text to the textboxes without the padded spaces being added when the maxlength of the field is not used?

View 3 Replies View Related

DTS - Problem On After Inserting .csv File Into Sql Database

Dec 11, 2007

Hello,
I inserted a .csv file into the database using DTS and it get inserted successfully.
But my problem is, the csv file contains the datas that has double quotes  on it (eg: 1/2" iron rod, 3/4" wooden rod).
When I checked the inserted datas, it was inserted as "1/2" iron rod, 3/4"""," 3/4" wooden rod"".
How do I eliminate these additional double quotes.
Raviraj Danasekaran

View 1 Replies View Related

Bulk Insert - Inserting Only One Column From Data File

Sep 29, 2007



Hi,

I have a data file in the folloing format

SubjectId1|class1
SubjectId2|class2
SubjectId3|class3


I just wanted to insert only SubjectIds into my table 'Subjects' which has the follwing schama ignoring the classes
The row delimeter is "
" and the column delimeter is ' | '

Table Subjects
{

ID (Autoincrement)
SubjectId varchar(20)
}

Can any one provide the format file for doing this or suggest anyway to do this?
Please do note that the file may contain millions of records

Thank u
~mohan

View 5 Replies View Related

Exporting Data From SQL Table To Excel File - How To Delete Rows Before Inserting New

Feb 5, 2007

Hi,

Question pls. I have an MS SQL local package where it exports data from SQL table to Excel file. My question is, how can erase all the records in my excel file before i export the new data from SQL table?

What i want is to delete the rows in the destination file before inserting new records.

Thanks a lot.

View 7 Replies View Related

Regarding Inserting Data From GUI To Database

Feb 28, 2008

Hi iam working with the form which has fields like AuditName,Industry Name,Company Name,Plant Name,Group Name,AuditStartedOn,Auditperiod upto,CreatedOn,createdby
I have dropdownlists for Industry Name,Company Name,Plant Name,Group Name.Data will be filled into Industry Name,Group Name when pageloads from the database and later depending on industryname company name and depending on company name plant name ddl's wiil be filled.
Later to insert this into the Audit table i had given the Stored procedure as :
create procedure CreateAudit
(
@AuditName nvarchar(50),
@IndustryName nvarchar(50),
@IndustryID int output,
@CompanyName nvarchar(50),
@CompanyID int output,
@PlantName nvarchar(50),
@PlantID int output,
@GroupName nvarchar(50),
@GroupID int output,
@AuditStartedOn datetime,
@AuditScheduledto datetime,
@CreatedOn datetime,
@CreatedBy int
)
as
begin
//Here iam getting the Id of the industryname selected in the ddl from industry table into an output parameter  @IndustryID
select @IndustryID=Ind_Id_PK from Industry where Industry_Name=@IndustryName
//Here iam getting the Id of the companyname selected in the ddl from company table into an output parameter  @CompanyID
select @CompanyID=Cmp_ID_PK from Company where Company_Name=@CompanyName
//Here iam getting the Id of the plantname selected in the ddl from plant table into an output parameter  @PlantID
select @PlantID=Pl_ID_PK from Plant where Plant_Name=@PlantName
//Here iam getting the Id of the Groupname selected in the ddl from Group table into an output parameter  @GroupID
select @GroupID=G_ID_PK from Groups where Groups_Name=@GroupName
Insert into Audits(Audit_Name,Audit_Industry,Audit_Company,Audit_Plant,Audit_Group,Audit_Started_On,Audit_Scheduledto,Audit_Created_On,Audit_Created_By)values(@AuditName,@IndustryID,@CompanyID,@PlantID,@GroupID,@AuditStartedOn,@AuditScheduledto,@CreatedOn,@CreatedBy)
end
Later called these parameters into class file:
 
namespace xyz{
public class clsCreateAudit
{SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["constr"]);
SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter();public clsCreateAudit()
{
con.Open();
}public void CreateAudit(string Audit_Name, int Audit_Industry, int Audit_Company, int Audit_Plant, int Audit_Group, DateTime Audit_Started_On, DateTime Audit_Scheduledto, DateTime Audit_Created_On, string Audit_Created_By)
{
cmd.Connection = con;cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "CreateAudit";
SqlParameter AuditName = new SqlParameter();AuditName.ParameterName = "@AuditName";AuditName.DbType = DbType.String;
AuditName.Value = Audit_Name;AuditName.Direction = ParameterDirection.Input;
cmd.Parameters.Add(AuditName);
SqlParameter AuditIndustry = new SqlParameter();AuditIndustry.ParameterName = "@IndustryName";AuditIndustry.Direction = ParameterDirection.Input;
AuditIndustry.Value = Audit_Industry;AuditIndustry.DbType = DbType.String;
cmd.Parameters.Add(AuditIndustry);
SqlParameter IndustryID = new SqlParameter();IndustryID.ParameterName = "@IndustryID";
IndustryID.Direction = ParameterDirection.Output;IndustryID.DbType = DbType.Int32;
//IndustryID.Size = 100;
cmd.Parameters.Add(IndustryID);SqlParameter AuditCompany = new SqlParameter();
AuditCompany.ParameterName = "@CompanyName";AuditCompany.Direction = ParameterDirection.Input;
AuditCompany.Value = Audit_Company;AuditCompany.DbType = DbType.String;
cmd.Parameters.Add(AuditCompany);SqlParameter CompanyID = new SqlParameter();
CompanyID.ParameterName = "@CompanyID";CompanyID.Direction = ParameterDirection.Output;
CompanyID.DbType = DbType.Int32;
//IndustryID.Size = 100;
cmd.Parameters.Add(CompanyID);
 SqlParameter AuditPlant = new SqlParameter();
AuditPlant.ParameterName = "@PlantName";AuditPlant.Direction = ParameterDirection.Input;
AuditPlant.Value = Audit_Plant;AuditPlant.DbType = DbType.String;
cmd.Parameters.Add(AuditPlant);SqlParameter PlantID = new SqlParameter();
PlantID.ParameterName = "@PlantID";PlantID.Direction = ParameterDirection.Output;
PlantID.DbType = DbType.Int32;
//IndustryID.Size = 100;
cmd.Parameters.Add(PlantID);SqlParameter AuditGroup = new SqlParameter();
AuditGroup.ParameterName = "@GroupName";AuditGroup.Direction = ParameterDirection.Input;
AuditGroup.Value = Audit_Group;AuditGroup.DbType = DbType.String;
cmd.Parameters.Add(AuditGroup);SqlParameter GroupID = new SqlParameter();
GroupID.ParameterName = "@GroupID";GroupID.Direction = ParameterDirection.Output;
GroupID.DbType = DbType.Int32;
//IndustryID.Size = 100;
cmd.Parameters.Add(GroupID);SqlParameter AuditStartedOn = new SqlParameter();
AuditStartedOn.ParameterName = "@AuditStartedOn";AuditStartedOn.Direction = ParameterDirection.Input;
AuditStartedOn.Value = Audit_Started_On;AuditStartedOn.DbType = DbType.String;
cmd.Parameters.Add(AuditStartedOn);SqlParameter AuditScheduledto = new SqlParameter();
AuditScheduledto.ParameterName = "@AuditScheduledto";AuditScheduledto.Direction = ParameterDirection.Input;
AuditScheduledto.Value = Audit_Scheduledto;AuditScheduledto.DbType = DbType.String;
cmd.Parameters.Add(AuditScheduledto);SqlParameter CreatedOn = new SqlParameter();
CreatedOn.ParameterName = "@CreatedOn";CreatedOn.Direction = ParameterDirection.Input;
CreatedOn.Value = Audit_Created_On;CreatedOn.DbType = DbType.String;
cmd.Parameters.Add(CreatedOn);SqlParameter CreatedBy = new SqlParameter();
CreatedBy.ParameterName = "@CreatedBy";CreatedBy.Direction = ParameterDirection.Input;
CreatedBy.Value = Audit_Created_By;CreatedBy.DbType = DbType.Int32;
cmd.Parameters.Add(CreatedBy);
cmd.ExecuteNonQuery();
con.Close();
}
}
}
Then i called these function into .aspx.cs file:
 
using xyz;protected void btn_CreateAudit_Click(object sender, EventArgs e)
{SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["constr"]);
PCRA.clsCreateAudit obj = new PCRA.clsCreateAudit();
SqlCommand cmd = new SqlCommand();
//Iam getting the Session(UID) from my login page.obj.CreateAudit(txt_AuditName.Text, Convert.ToInt32(ddl_Industry.SelectedItem.Value), Convert.ToInt32(ddl_Company.SelectedItem.Value), Convert.ToInt32(ddl_Plant.SelectedItem.Value), Convert.ToInt32(ddl_Group.SelectedItem.Value), Convert.ToDateTime(txt_StartingOn.Text.ToString()), Convert.ToDateTime(txt_AuditPeriod.Text.ToString()), System.DateTime.Now, Session["UID"].ToString());lbl_Mesg.Text = "Your Audit Details are added succesfully";
}
 
But iam getting an error here near obj.CreateAudit as:
Input string was not in a correct format.
I even want to know if my storedprocedure reaches the requirement which i specified.
please help me with this.Its very urgent.
 

View 1 Replies View Related

INSERTING DATA INTO SQL DATABASE

Apr 9, 2008

I have table in my SQL db

I am inserting value using insert statement

Following are statement which I am using when inserting data into database

INSERT INTO EMPLOYEE (NAME, TELEPHONE, PINNUM,CELLNUM)
SELECT NAME,TELEPHONE,PINNUM FROM EMPLOYEE WHERE EMPLOYEEID=1

Noticed that I dont have CELLNUM In my select statment, but I want to insert that number from textbox which I have on my webform.
can some one tell me how do i do this query so i can insert data into database.

HELP ME
thank u
maxs

View 6 Replies View Related

Error While Inserting Data In DataBase ?

Oct 15, 2006

my requirment is insert TableName and JourneyDate and FlightNumber alongwith otherdata at RunTime but i get error, I tried it several times. Table Structure is:  Create Table HA142
(
JourneyDate DateTime primary key,
FlightNo char(5)not null FOREIGN kEY REFERENCES FLIGHTS(FlightNo),
FirstClassSeatAvalable int,
BusinessClassSeatAvalable int,
EconomyClassSeatAvalable int,
FsWaitingAvalable int,
BsWaitingAvalable int,
EcWaitingAvalable int
)  string flightno = drpFlightNo.SelectedItem.Text;
string JourneyDate = Session["JourneyDate"].ToString();
string newStrign = ",18,42,280,3,7,35)";
SqlConnection myConn = new SqlConnection("workstation id=JASIM;packet size=4096;user id=ASPNET;data source=JASIM;persist security info=False;initial catalog=Test");
SqlCommand populateFlightTable = new SqlCommand("INSERT INTO "+flightno+" VALUES("+JourneyDate+","+flightno+newStrign,myConn);
myConn.Open();
populateFlightTable.ExecuteNonQuery();
myConn.Close(); whenever compiler reached to populateFlightTable.ExecuteNonQuery(); I received error. i tried it to rectify several times but no result.plz hemp me...

View 3 Replies View Related

Problems On Inserting Data Into Database

Sep 11, 2007

Hi all, I want to insert some data that from a table into a database, and I got the error message-- "The variable name '@IssueID' has already been declared. Variable names must be unique within a query batch or stored procedure."  Is it anything wrong with my code? Thanks a lot.

            Dim row As Data.DataRow
            For Each row In table.Rows
                DataSource.InsertParameters.Add("IssueID", row(0))                DataSource.InsertParameters.Add("UserName", Session("loginName"))                DataSource.InsertParameters.Add("IssueCost", row(1))                DataSource.InsertParameters.Add("IssueDesc", row(2)) 
                DataSource.Insert()
            Next row 

View 4 Replies View Related

Inserting Test Data In To The Database

Jan 3, 2001

How can i insert test Data in to the Database,I want to insert one million records in to the table,This is to test Database Performance.
Can anyone help me in this regard,Do we have any scripts for this purpose???
thanks
Mar

View 4 Replies View Related

Inserting Data Into A Database Alphabetically

Jul 20, 2005

Hello, is it possible to insert new data into a datbasealphabetically? For example when a user enters a new row of data, Iwant the row inserted in the correct order. I do not think this ispossible.Thank you for the help!

View 1 Replies View Related

Inserting Ascii Data Into SQL Database

Aug 22, 2006



Hi everyone,



I need to save the ascii data in my sql express 2005 database in one table and in 2 coloums in this table using VB express...

Can I do it by datareader or with bulk insert t-sql command?

I tried it this way but it gives error like "connection property is not initialised" it is on executenonquery row in the code...

Dim cmd = New SqlCommand("BULK INSERT RFID.dbo.stock(material_number,total) FROM 'C:can1.txt' " & _

"WITH FIELDTERMINATOR = ',', ROWTERMINATOR = '' ")

connection.Open()

cmd.executenonquery()

connection.Close()



I hope some can help with this problem....

View 6 Replies View Related

Move Text Data (not A File) Into An Image Data Type

Mar 11, 2008



The ERP manufacturer used an image data type to store large text data fields. I am trying to move these data types from one database to another database using either Sql Queries or MS Access. I can cast them as an 8000 char varchar to read them directly but have no luck importing into these image data fields.

Access and Crystal are not able to read these fields directly.

Any suggestions? Most information about these fields has to do with loading files but I am just moving data.

Thanks,

Ray

View 1 Replies View Related

Loading Data Froma A Text File To SQL Data Base

Sep 10, 2007

Hello!! searching information about how to migrate some date from an old data base (any tipe) from SQL I´v found this:
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[FIELDS
[TERMINATED BY 'string']
[[OPTIONALLY] ENCLOSED BY 'char']
[ESCAPED BY 'char' ]
]
[LINES
[STARTING BY 'string']
[TERMINATED BY 'string']
]
[IGNORE number LINES]
[(col_name_or_user_var,...)]
[SET col_name = expr,...)]
Does anybody know how does it works and how to use it????I´d like to know because I have to load data from a text file to a SQL Data Base and this seems to be te fastest an easiest way to do it...Thanks!!!!bye!

View 1 Replies View Related

Retrieve Text File Data In SSE For Data Acquisition System

Oct 24, 2007

Hey All,
I am developing a data acquistion system which monitors the amount of energy that a user consumes in different parts of a house and displays the information in real time on their computer screen. I am collecting the data through tranducers attached to the circuit breakers in the breaker box and sending the data to analog-to-digital converter channels in a MCU. I am retrieving the data from the serial port and storing it to a text file. Each line of data in the text file represents three fields which are separated by commas. I will be reading data from multiple data collection boxes so the first field is the unit number, the second fied represents the analog-to-digital converter channel number from each unit, and the third field is the data that is collected from the ATD channel. I am trying to use SSE to retrieve the data from the text file, and parse each line of data into individual columns in a databse. Then I want to be able to extract the data associated with a particular ATD channel number from the databse and display it in the appropriate text field on a windows form.
I've got the MCU programmed. I have no problem collecting the data from the serial port, and I can do the visual basic programming okay. I have absolutely no clue how to read the data into the database, continuosly read new values into the databse, and then access the stored data to update the text fields on the form. Please help if you can, I've been working on this specific problem for a couple of weeks and I'm not making any progress. Thanks.

View 3 Replies View Related

Retrieve Text File Data In SSE For Data Acquisitio

Oct 24, 2007

Hey All,
I am developing a data acquistion system which monitors the amount of energy that a user consumes in different parts of a house and displays the information in real time on their computer screen. I am collecting the data through tranducers attached to the circuit breakers in the breaker box and sending the data to analog-to-digital converter channels in a MCU. I am retrieving the data from the serial port and storing it to a text file. Each line of data in the text file represents three fields which are separated by commas. I will be reading data from multiple data collection boxes so the first field is the unit number, the second fied represents the analog-to-digital converter channel number from each unit, and the third field is the data that is collected from the ATD channel. I am trying to use SSE to retrieve the data from the text file, and parse each line of data into individual columns in a databse. Then I want to be able to extract the data associated with a particular ATD channel number from the databse and display it in the appropriate text field on a windows form.
I've got the MCU programmed. I have no problem collecting the data from the serial port, and I can do the visual basic programming okay. I have absolutely no clue how to read the data into the database, continuosly read new values into the databse, and then access the stored data to update the text fields on the form. Please help if you can, I've been working on this specific problem for a couple of weeks and I'm not making any progress. Thanks.

View 1 Replies View Related

Inserting Blank Data In Sql Server Database - Why?!?!

Oct 23, 2006

Hi everyone!Hope that someone can help me solving this problem.I have a form where the user can register by putting his private data. Each time that he submits his data, if he is using Internet Explorer, it will insert blank data into sql server database. But if user is using Firefox, everything is working well, and all data is inserted.What seems to be the problem?Why in IE, data is inserted as blank?!Thanks for your possible help and attention to this issue.Hope that someone can help me.Best regards,Mesk

View 2 Replies View Related

Problem Inserting Data Into A SQL Express Database

Feb 21, 2007

I am trying to implement a code behind page (in VB) to insert data into a sql express database but something is not right.  Any help would be greatly appreciated.  The following is the code I have:Protected Sub SaveButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveButton.Click        Dim connString As String = "Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|News.mdf;Integrated Security=True;User Instance=True;Asynchronous Processing=true"        Dim sqlInsert As String = "INSERT INTO news_Article (Heading, Story, Author, Show_on_homepage) VALUES(@heading, @story, @author, @show)"        Dim conn As New System.Data.SqlClient.SqlConnection(connString)        Dim cmd As New System.Data.SqlClient.SqlCommand(sqlInsert, conn)        Dim heading = HeadingTextBox.Text        Dim story = StoryEditor.Value        Dim author = AuthorTextBox.Text        Dim show = ShowHPCheckBox.Checked        conn.Open()        cmd.BeginExecuteNonQuery()        conn.Close()End Sub 

View 4 Replies View Related

ASP.NET +Inserting Data From Xml In SQL Server Database Table From ASP.NET

May 31, 2007

hi
I want to read data from XML file and insert that data from XML file into the Database Table From ASP.NET page.plz give me the code to do this using DataAdapter.Update(ds) 

View 1 Replies View Related

Inserting Data Into Database Field SmallMoney

Jun 5, 2007

 what i understand if if the data field is integer or money, not string, then i need to do a convert(datatype, value) in the insert but how come its still not working INSERT INTO [Product] ([Title], [Description], [Processor], [Motherboard], [Chipset], [RAM], [HDD], [OpticalDrive], [Graphics], [Sound], [Speakers], [LCD], [Keyboard], [Mouse], [Chassis], [PSU], [Price]) VALUES (@Title, @Description, @Processor, @Motherboard, @Chipset, @RAM, @HDD, @OpticalDrive, @Graphics, @Sound, @Speakers, @LCD, @Keyboard, @Mouse, @Chassis, @PSU, convert(smallmoney, @Price))  

View 1 Replies View Related

Problems Inserting And Updating Data Into Sql Database

Mar 26, 2008

i am creating a database driven website and i am using a sql database. I have a database called company with fields in it to do with a company, I have created a company.cs file which sets the variables, properties and methods and so on. These work fine. I have also stored procedures and they are right as far as i know. i also have coding behind the buttons of my page when i try and update or insert to the database. I am having the problem of when i enter data into the text boxes and click update, nothing gets inserted or updated and whats worst of all no error message appears. The table is used for storing profile data about a user, when a user logs on they enter their profile data, if i manually enter this data and input the username of a user into the username field within the database then the data appears fine in the textboxes of the update info page but the data will not insert or update. i have checked all the little things and i am stressing out cos i am running out of time and cannot find the problem...........please could someone help me!!!!! thanks
 
Heres my coding to some of my pages to help you....
the code behind the button
using System;
using System.Data;
using System.Configuration;
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 FYPtestsite.Classes;
public partial class Employer_employerprofile : System.Web.UI.Page
{protected void Page_Load(object sender, EventArgs e)
{if (!Roles.IsUserInRole(ConfigurationManager.AppSettings["employerrole"]))
{Response.Redirect("~/Error1.aspx");
}Company objCompany = Company.GetCompany(Profile.UserName);if (objCompany != null)
{
 
txtCompanyname.Text = objCompany.Companyname;
txtAddress1.Text = objCompany.Address1;
txtAddress2.Text = objCompany.Address2;
txtPostcode.Text = objCompany.Postcode;
txtCity.Text = objCompany.City;
txtPhone.Text = objCompany.Phone;
txtFax.Text = objCompany.Fax;
txtEmail.Text = objCompany.Email;
txtURL.Text = objCompany.URL;
txtProfile.Text = objCompany.Profile;
}
}protected void Button2_Click(object sender, EventArgs e)
{Response.Redirect("~/homepage.aspx");
}protected void Button3_Click(object sender, EventArgs e)
{Company objCompany = new Company();
objCompany.UserName = Profile.UserName;
objCompany.Companyname = txtCompanyname.Text;
objCompany.Address1 = txtAddress1.Text;
objCompany.Address2 = txtAddress2.Text;
objCompany.Postcode = txtPostcode.Text;
objCompany.City = txtCity.Text;
objCompany.Phone = txtPhone.Text;
objCompany.Fax = txtFax.Text;
objCompany.Email = txtEmail.Text;
objCompany.URL = txtURL.Text;
objCompany.Profile = txtProfile.Text;
 if (Profile.Employer.CompanyID != -1)
{objCompany.CompanyID = (int)Profile.Employer.CompanyID;Company.Update(objCompany);
}
else
{int i = Company.Insert(objCompany);
Profile.Employer.CompanyID = i;
}labelstatus.Text = "Your profile has been successfully updated";
}
}
 
 
Any help would be greatly greatly appreciated!!!!!!

View 10 Replies View Related







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