SQL Express 'hangs' When Executing An INSERT

Feb 14, 2008

Periodically an INSERT query takes anywhere from 30 to 90 sec's to execute. But once it completes, execution times then return to 0 or 1 sec. This has begun to occur more and more frequently, typically every thirty minutes or so now.
The only way I have found to clear the problem is to execute the INSERT from SQL Studio and just wait for it to complete. Then everything returns to normal, until it hangs again. The application that commands the INSERT can not be made to just wait for 90 seconds, so I need to know how to eliminate the intermittent delay.
What could be causing this problem, and how can it be corrected?

View 5 Replies


ADVERTISEMENT

SSIS Hangs Executing SP...

May 23, 2008



I have a stored procedure which when executed from management studio completes successfully.
If I invoke the stored procedure from SSIS which in turn is called from a SQL Server job the jobs runs indefnitely.


Now I wanted to see how far did it go in the execution of sp and I had some logging done at various places in stored procedure....It came till the RETURN 0 , the last statement of sp. The call to the SP is the last task in the SSIS package...So if the sp is alsmost completed and execute sql task is the last one in SSi, why is the job running indefinitely.

Please help....MVPs....

View 1 Replies View Related

Executing Stored Procedure... Hangs...

Oct 2, 2007

Hi
I have a stored procedure in SQL Server 2005. It make a backup of a database and restores it to a different name.I use ASP.NET and Framework 1.1.It works really fine when I use SQL Server 2000.
But!When trying to do the same thing on SQL Server 2005, the database seems to be created "half way" I can see that the database is created, but after the name is the text Restoring....It never finish restoring.... and nothing shows in the server logs.
Any ideas?Differences between SQL Server 2000 and SQL Server 2005 that I must be aware of?Priviliges?ConnectionString parameters?Drivers?
I'm using .NET Framework 1.1ODBC (SQL Native Client)
Here is the Store procedure code:set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
 ALTER PROCEDURE [dbo].[CreateProjectDataBase]
@AFModelDatabaseProject varchar(200),
@TemplateDbBackupFileAndName varchar(200),
@DatabaseName varchar(200),
@DataFilePathAndName varchar(200),
@LogFilePathAndName varchar(200)
AS
 
BACKUP DATABASE @AFModelDatabaseProject TO DISK = @TemplateDbBackupFileAndName
WITH INIT
RESTORE DATABASE @DatabaseName FROM DISK = @TemplateDbBackupFileAndName
WITH MOVE 'AdressTNG_Project_Data' TO @DataFilePathAndName,
MOVE 'AdressTNG_Project_Log' TO @LogFilePathAndName
 
and here is how it is called from within .NET:this.odbcCreateDataBaseCommand.CommandType = System.Data.CommandType.StoredProcedure;
this.odbcCreateDataBaseCommand.Parameters["@AFModelDatabaseProject"].Value = afModelDataBaseName;this.odbcCreateDataBaseCommand.Parameters["@TemplateDbBackupFileAndName"].Value = TemplateDbBackupFileAndName;
this.odbcCreateDataBaseCommand.Parameters["@DatabaseName"].Value = dbName;this.odbcCreateDataBaseCommand.Parameters["@DataFilePathAndName"].Value = DataFilePathAndName;
this.odbcCreateDataBaseCommand.Parameters["@LogFilePathAndName"].Value = LogFilePathAndName;this.odbcCreateDataBaseCommand.CommandText = "{ CALL CreateProjectDataBase(?,?,?,?,?) }";
this.odbcCreateDataBaseCommand.ExecuteNonQuery();
RegardsTomas

View 2 Replies View Related

Delpoyed Task Hangs On Executing

May 12, 2008

I have a task thet writes to an Oracle database.It works correctly from my development machine, but when I run it from the SQL Server it hangs on "Execute". I installed the Oracle Client on the server and tested it by making an ODBC connection and testing the connection. The task sat on "Executing" for 6 hours before I manually stopped it. It should only take about 1 minute or less. There are no errors in the history log. Does anyone have any suggestions on what I can do to determine why the task hangs on "Execute".

Thanks,
Lee

View 3 Replies View Related

Integration Services :: Executing SSIS Hangs

Apr 29, 2015

I created a SSIS package which loads CSV into database. The package is called in a C# console application which is set as scheduled task in a server. The problem I having is that the package hangs during validation stage: "Truncation may occur due to inserting data from data flow column "Reading Type" with a length of 50 to database column "ReadingType" with a length of 2."There is no problem loading same data from development machine.

View 5 Replies View Related

Visual Studio Hangs When Executing A Package (also DTEXEC)

Oct 31, 2007

Hi,

We have a problem with visual studio. It hangs when i use the "execute package" option. New packages are running correctly but the packages which i've already built are not executing anymore...Any ideas to get things on track again?

Gr,
Hennie

View 2 Replies View Related

SQL Server Express Hangs

Jun 8, 2007

Hi, I just installed SQL Server 2005 Express w/ Advanced Services (9.00.3042.00) on a Windows XP Pro workstation and I am having some trouble. When I launch the Management Studio and try to change or add anything - like creating a SQL Server login, or changing the default folder for databases - the software just hangs on "Executing".



For example, right now I am watching it still say "Executing" after just opening Server Properties and clicking OK without changing anything. It's been doing this for 15 minutes with no sign of it stopping.



I checked the ERRORLOG file and it seems to be completely clean with no errors. Similarly, the Windows Event Logs look clean.



Any ideas or suggestions on how to troubleshoot this issue? I've tried rebooting, reinstalling (and then rebooting) etc...



Is there a newer build for this?



Thanks



-JS



View 2 Replies View Related

Sql Server Express Hangs And Does Not Allow Any Connections

Jul 19, 2006

Hi,

We have few installations of SQL Server express on Windows 2003 servers, platforms varrying from Celeron to P4.

Sql Server on system hangs after running for some time. Time varies from few hours to few days.

When we try to connect it just gives connection timeout error.

Any idea how to isolate the problem?

We would like to to enable more detail tracing but do not know how to do that.

Thanks in advance.

View 6 Replies View Related

SQL Server Express Manager Installation Hangs

Sep 14, 2005

When i will try to install SQL Server Express Manager in W2K SP4, its fail with error in Event Viewer:

View 1 Replies View Related

HELP Sql Server 2005 Express Connection Hangs Up

Apr 9, 2007

Hi



I got an access 2002 application front end with a sql server 2005 express back end. Some of my clients are having some difficulties. After using the application for a while, some of the users are finding that the system just hangs up. It usually happens after the front end application has been running for about an hour (sometimes sooner and sometimes later). There are perhaps 1 to 5 concurrent users and I have checked to see if there are any firewalls stalling it (I think I check all of them)- Is there any way that SQL Server 2005 express could be caused to just stall- This even occurs with the odd laptop. All the appropriate protocols are enabled as well. These databses are not very large.



ANY HELP WOULD BE GREATLY APPRETIATED!!!



Thanks



Frank Srebot

View 4 Replies View Related

SQL Express Hangs On Setting Registry Security

Nov 9, 2005

The last few lines of the log show:

View 4 Replies View Related

Executing Insert SQLdatasource

Apr 24, 2007

Hey forum,
the .NET form controls make it extremely easy to manage database data, control + SQLdatasource et voilà , its there.
i have a web form, and a SQLdatasource with an insert query with parameters (works perfectly, only the Date picker Lite textbox ID as parameter wont register, but i have a thread runnin on their forums for that). when i open the Query builder and execute the query it works! woot! but now, how can i make it execute on a button press? i tried with several commands, like SQLdatasource1.execute, and several other commands i searched (can post later, not behind my test environment with my tools/webpage at the moment). so what is the command to let the SQLdatasource execute it's query? it's all i need to know to make several forms, please ghelp me! :)
gr. michael

View 2 Replies View Related

Capturing ID When Executing An INSERT

Jan 2, 2008

I have a bit of code that executes an INSERT statement to add a record to an existing table. This table of course has an automatically incrementing ID field, and I'd like to somehow have my INSERT statement return the value of that ID field so that I can automatically show the user the record they've added.

Is there a clean way to do this?

View 4 Replies View Related

... Executing Stored Procedures In An INSERT Statement ...

Aug 28, 2002

I am trying to simulate the <sequence name>.nextval of oracle in SQL Server 2000.

The situation is that i need to be able to run programmatically INSERT statements. In Oracle I am able to do INSERT INTO TABLE_A (ID, NAME) VALUES (TABLE_A_SEQUENCE.NEXTVAL, 'MIKKO') in a single prepared statement in my code.

I know that to recreate this in SQL Server 2000 I need to create a stored procedure and table to set up a way to generate "the next value" to use in my INSERT. but the schema below forces me to do my insert in 2 steps (first, to get the next value. second, to use that value in the INSERT statement), since I cannot execute the stored procedure inside my INSERT statement.

Is there any way for me to generate values within my INSERT statement that would simulate Oracle's <sequence name>.nextval and allow me to execute my INSERT in 1 line of code?

TABLE
-----
CREATE TABLE sequences (
-- sequence is a reserved word
seq varchar(100) primary key,
sequence_id int
);

MS SQL SERVER STORED PROCEDURE:
-------------------------------
CREATE PROCEDURE nextval
@sequence varchar(100)AS
BEGIN
-- return an error if sequence does not exist
-- so we will know if someone truncates the table
DECLARE @sequence_id int
set @sequence_id = -1

UPDATE sequences
SET @sequence_id = sequence_id = sequence_id + 1
WHERE seq = @sequence

RETURN @sequence_id
END

View 1 Replies View Related

SQL Express Timeout Error When Executing A View

Apr 17, 2007

I get the following error message:

SQL Exectution error,

Exectuted SQL statement: SELECT...

Source: .Net SqlClient data provider

Message: Timeout expired, timeout period elapsed prior to completion of the operation...



The view is operating on a table of ~250,000 records. The timeout occurs after 45 seconds, and none of the changes I make to the various timeout settings in the server or database seem to affect this.

When I execute the same sql statement in a query window it does complete, requiring about 7 minutes to execute.

How can I configure the view not to timeout when executing this query?



- Jim

View 6 Replies View Related

Executing SSIS Package - SQL 2005 Express

Jan 20, 2007

Hi,

 I have created SSIS Package using DTS vizard in SQL 2005 Express. Help me out to execute the Package.

 

Thanks

View 1 Replies View Related

Executing Store Procedre By Calling It From An Insert Trigger?

Feb 10, 2000

hi, I have a trigger on a table for insert, once there is new data into that table I want to run a nother store procedure by passing all input from inserted to the store procedure as input parameter. can I do that.

Thanks

Ali

View 4 Replies View Related

Executing A SSIS Package Programmatically Where Only SQL Express Is Installed

Apr 23, 2007

Hi,

I have created an application that loads a package and executes it using DTS runtime classes. But when I run the application on a machine where only SQL Express edition is installed it's throwing

"Retreiving COM class factory for component with CLSID E44847F1-FD8C-4251-B5DA-B04BB22E236E failed due to the following error : 80040154"



Can someone help?

View 1 Replies View Related

Executing SSIS Packages From Client Machine Using SQL Express Engine

May 26, 2006

I have few DTSX packages on my SQL server 2005. These packages are supposed to transfer data and stored procedures from server to client Express engine. The scenario is that when user connects with the server he should run some kind of utility or any other way to run those SSIS packages so that the data could be transfered.

Remember the user machine has only SQL Express Engine and the packages are in SQL server 2005 machine.

Can any one help me out how to achive this scenario?

Regards...

View 4 Replies View Related

Data Warehousing :: Cannot Insert Value NULL Into Column When Executing Stored Procedure

Sep 22, 2015

I received this stored procedure that I modified to run on my system.  Specifically, I only changed the database and filter text and left the rest alone.  When I execute the stored procedure, I get the error:

Msg 515, Level 16, State 2, Procedure ObjectNotesInsert, Line 18
Cannot insert the value NULL into column 'RefRowPointer', table 'pSCI_App.dbo.ObjectNotes'; column does not allow nulls. INSERT fails. The statement has been terminated.

Here is the actual stored procedure I am running. I should add that I can execute each step and get results and if I hard code the resulting values into the procedure, the execution works. 

USE [pSCI_App]
GO
/****** Object: StoredProcedure [dbo].[_JAMTestSp] Script Date: 09/21/2015 11:32:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

[Code] ....

View 30 Replies View Related

Stored Procedure Executing Durations Are Different Between Executing From Application(web) And SQl Server Management Studio - Qu

Jan 24, 2008



Hi,

I have a web application using Stored Procedure (SP). I see that there's a SP taking long time to execute. I try to capture it by Profiler Tool, and find out that with the same SP on the same db with the same parameter. The duration of executing by my web app is far bigger than the duration of executing on SQl server management studio - query window

Please see the image through this url http://kyxao.net/127/ExecutionProblem.png


Any ideas for this issue?

Thanks a lot

View 1 Replies View Related

Stored Procedure Executing Durations Are Different Between Executing From Application(web) And SQl Server Management Studio - Query Window

Jan 23, 2008

Hi,I have a web application using Stored Procedure (SP). I see that there's a SP taking long time to execute. I try to capture it by Profiler Tool, and find out that with the same SP on the same db with the same parameter. The duration of executing by my web app is far bigger than the duration of executing on SQl server management studio - query windowPlease see the image attached http://kyxao.net/127/ExecutionProblem.png Any ideas for this issue?Thanks a lot Jalijack 

View 2 Replies View Related

Different Results When Executing From .NET Component Compare To Executing From SQL Management Studio

Oct 10, 2006

Hi all,I am facing an unusual issue here. I have a stored procedure, that return different set of result when I execute it from .NET component compare to when I execute it from SQL Management Studio. But as soon as I recompile the stored procedure, both will return the same results.This started to really annoying me, any thoughts or solution? Thanks very much guys

View 2 Replies View Related

Management Studio Express &&amp; SQLcmd: Syntax Errors In Executing A MS-DOS Batch File &&amp; A Microsoft SQL Server Query File?

Nov 2, 2007

Hi all,
I have the "Northwind" database in my Sql Server Management Studio Express.

In my C:ProSSEAppsSamplesForChapter02Chapter02 folder, I have the following 2 files:
(1) ListColumnValues (MS-DOS Batch File)
sqlcmd -S .sqlexpress -v DBName = "Northwind" CName = "CompanyName" TName =
"Shippers" -i c:prosseappschapter02ListListColumnVales.sql -o
c:prosseappschapter02ColumnValuesOut.rpt
(2) ListColumnValues (Microsoft SQL Server Query File)
USE $(Northwind)
GO
SELECT $(CompanyName) FROM $(Shippers)
GO
When I ran the following SQLcmd:
C:ProSSEAppsSamplesForChapter02Chapter02>ListColumnValues.bat
I got the following "ColumnValuesOut.rpt" with error messages:

'Northwind' scripting variable not defined.
Msg 102, Level 15, State 1, Server L1P2P3SQLEXPRESS, Line 1
Incorrect syntax near '$'.
'CompanyName' scripting variable not defined.
'Shippers' scripting variable not defined.
Msg 102, Level 15, State 1, Server L1P2P3SQLEXPRESS, Line 1
Incorrect syntax near 'CompanyName'.

I copied these T-SQL statements from a book and I do not know how to correct them.
Please help and tell me how to correct these errors.

Thanks in advance,
Scott Chang




View 3 Replies View Related

How To Insert Binary To SQL Express By VBA?

Oct 4, 2007

Hi all,

In the end of the post, there is my vba functions and query to create datatable. I got a run-time error message on the red line in the function. It says: [sql native client] string data right truncation. Did I do sometime wrong? Thanks for your time!

-L

Sub test()
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
Dim mConn As ADODB.Connection
'read the file data to bytes
'Specify stream type - we want To get binary data.
BinaryStream.Type = adTypeBinary
'Open the stream
BinaryStream.Open
'Load the file data from disk To stream object
BinaryStream.LoadFromFile file
Dim mCmd As ADODB.Command
Set mCmd = New ADODB.Command
With mCmd
' define query
.CommandText = "INSERT INTO TEST (FDATA) " & _
"VALUES (?)"
.CommandType = adCmdText
' add parameter
.Parameters.Append .CreateParameter("@P1", adVarBinary, _
adParamInput, BinaryStream.Size, BinaryStream.Read)
End With
' open db connection
mConn.ConnectionString = _
"Driver={SQL Native Client};Server=.SQLEXPRESS;Database=XXXX;Trusted_Connection=yes;"
mCmd.ActiveConnection = mConn
'run-time error: [sql native client] string data right truncation
mCmd.Execute
mConn.Close
End Sub



GO
/****** Object: Table [dbo].[TEST] Script Date: 10/04/2007 11:06:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TEST](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FDATA] [varbinary](max) NOT NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

View 3 Replies View Related

Data Insert Via SQL Express Using VB Issue

Jun 27, 2006

I've been doing a lot of research lately to determine the most secure way to issue an insert statement to insert my data into my SQL database.  I'm coding this following using Visual Basic: Protected Sub submitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)

Dim strConn As String = "server=.SQLEXPRESS;database=C:SJ-siteSJApp_DataSJDb.mdf; User Id=user; password=password"
Dim MyQuery As String = "Insert into sjTable (PostID, Category, TitleofPost, Description, Price, Loc, ContactInfo, DatePosted, Disclaimer) Values (@Category, @TitleofPost, @Description, @Price, @Loc, @ContactInfo, @DatePosted)"
Dim MyConn As New Data.SqlClient.SqlConnection(strConn)
Dim cmd As New Data.SqlClient.SqlCommand(MyQuery, MyConn)
Dim curDate As String
On Error Resume Next

MyConn.Open()
If Err.Number <> 0 Then
MsgBox("There was an error connecting to the database.", MsgBoxStyle.OkOnly)
Err.Number = 0
End If

curDate = Now()
With cmd.Parameters
.Add(New System.Data.SqlClient.SqlParameter("@Category", categoryDropDown.Text))
.Add(New System.Data.SqlClient.SqlParameter("@TiteofPost", titleTextbox.Text))
.Add(New System.Data.SqlClient.SqlParameter("@Description", descriptionTextbox.Text))
.Add(New System.Data.SqlClient.SqlParameter("@Price", priceTextbox.Text))
.Add(New System.Data.SqlClient.SqlParameter("@Loc", locationTextbox.Text))
.Add(New System.Data.SqlClient.SqlParameter("@ContactInfo", contactTextbox.Text))
.Add(New System.Data.SqlClient.SqlParameter("@DatePosted", curDate))
End With
If Err.Number <> 0 Then
MsgBox("There was an error inserting the data into the database.", MsgBoxStyle.OkOnly)
Err.Number = 0
End If

MyConn.Close()
If Err.Number <> 0 Then
MsgBox("There was an erro closing the database connection.", MsgBoxStyle.OkOnly)
Err.Number = 0
End If
Server.Transfer("submitted.aspx")


End Sub The code gives no errors, it directs me straight to the
submitted.aspx page but when I query the database it is not inserting
any data into my database.  .My Error log shows the following:2006-06-27 12:14:16.68 spid51      Starting up database 'C:SJ-SITESJAPP_DATASJDB.MDF'.2006-06-27 12:14:26.93 Logon       Error: 17828, Severity: 20, State: 3.2006-06-27 12:14:26.93 Logon       The prelogin packet used to open the connection is structurally invalid; the connection has been closed. Please contact the vendor of the client library. [CLIENT: <local machine>]I am able to log into the database using my account via SQL Server Management Studio Express.  I've been all over the forums and google looking for a solution but everything I've been trying to mock up from other people's code hasn't helped.  Thanks in advance for your assistance

View 3 Replies View Related

SQL Express 2005 Insert Command

Aug 30, 2006

I have the following insert parameter and insert command which are attached to a templated textbox, I have made the textbox's visible property false so the user will not enter any text. I have a session variable session("test") = 500. I would like the value of the session variable to be inserted into the testcode field. I can not seem to find any workable syntax.<InsertParameters> <asp:Parameter Name="TestlCode" Type="Int32" />InsertCommand="INSERT INTO [Mycd] ( [TestlCode], ..   VALUES ( @testcode ,

View 1 Replies View Related

SQL Server Express Bulk Insert

Oct 25, 2006

does anyone know how to do a bulk insert in SQL Server Express thanks Marcel

View 2 Replies View Related

Faulty Insert Into Sql Express Database

Apr 2, 2007

Hello All,

I have an InfoPath form that submits data to a .NET webservice. The webservice parses the infopath form and inserts the data into a database. The database is SQL Server EXPRESS.

I have however run into some problems. The InfoPath form is within SharePoint and I noticed that when I submit the data, it only shows up in the database as a new record 9 out of 10 times. That is for every 10 submissions of the form, there are only about 9 new records in the database. The ID field (an autoincrement field) also skips a number indicating the the transaction may have failed.

However, when I test the form on my local PC, it inserts a new record for every submission.

The webservice and database are on a remote server not my local.

Does anyone have any ideas? Could it be a deficiency of SQL Server Express?

Any ideas, answers or suggestions would be much appreciated.

View 1 Replies View Related

Insert Data Into SQL SERVER EXPRESS Edition

Apr 20, 2007

I'm completely new to ASP.NET. I want to insert data to the SQL SERVER EXPRESS database.When the button clicks i want to add the details into database.This is the coding i did with online help.
Can you help me to do a good coding ad some error showing on my 7th line("connection.Open()")..
And can you advise me to do correct coding for how is get data from database and display it on web page.
Thanks in advance.And here is the coding i did to Insert data,
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connection As New SqlConnection(" database=share")
Dim cmd As New SqlCommand("INSERT INTO sdetails (cid, cname, date, qty, pps)VALUES('" & txtcid.Text & "','" & txtcname.Text & "','" & txtdate.Text & "','" & txtqty.Text & "','" & txtpps.Text & "')", connection)
 
connection.Open()
connection.Close()
End Sub

View 2 Replies View Related

Insert Command In Sql Server Express Edition Using ASP.net C# Lan

Dec 31, 2007

Hi,
 i'm creating registeration form using VS2005, i want to insert values in sql server express 2005. i've coded but it is giving error plz hava a look
 for example my database name is Database1 and table is table1
and columns are name,title. 
here i'm getting error : connectionstring does not exist. 
 
code as folllows
SqlConnection connection = new SqlConnection(ConnectionString1);      
        string cmdString = "Insert into Table1(name,title)VALUES( @Name,@title)";
        SqlCommand cmd = new SqlCommand(cmdString, connection);
        cmd.Parameters.Add(new SqlParameter("@name",txtNameText));          cmd.Parameters.Add(new SqlParameter("@title",txtTitle.Text) );                        connection.Open();        cmd.ExecuteNonQuery();        connection.Close();
 
thanks in advance

View 6 Replies View Related

Insert Data To MsSQL Express Database?

Jan 4, 2008

Hello there,I'm to asp.net, so please be patient :DMy question is, how do I simply add some data to my database? - With vb.net code, not a grid view or something like that..I want to connect to my database, insert some data to a table.It shouldn't be that hard?- Hope someone will take the 5 minutes, and help me :)Regards Jeppe

View 16 Replies View Related

Insert Record Into Sql Database Express When Button Pressed

Apr 30, 2008

I'm new to asp.net and I have gotten quite far with books and such but I'm stuck at this point. I have a web form that is mostly populated with data pulled from AD and all the user does is make a selection in two drop lists and enter their initials to sign. I can't figure out how to insert a record into a table when buttin pressed. I verified that all the data types are correct so it shoud pass the info but its just not going anywhere. I've atached the code below.
Thanks,protected void accept_btn_Click(object sender, EventArgs e)
{
string adPath = LDAP://DC=********,DC=***; //Path to your LDAP directory servermembers adAuth = new members(adPath);
 string username = Context.User.Identity.Name;
string computer_name = System.Environment.MachineName;string comp_type = comptype.SelectedValue.ToString();
string install_type = installtype.SelectedValue.ToString();string date = DateTime.Now.ToString();
string email = adAuth.getemail(Context.User.Identity.Name);string agree = initials_txtbox.Text;string title = "Office";
 test_lbl.Text = (username + " " + computer_name + " " + comp_type + " " + install_type + " " + date + " " + email + " " + agree + " " + title);
 
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand();
System.Data.OleDb.OleDbParameter parameter1 = new System.Data.OleDb.OleDbParameter();System.Data.OleDb.OleDbParameter parameter2 = new System.Data.OleDb.OleDbParameter();
System.Data.OleDb.OleDbParameter parameter3 = new System.Data.OleDb.OleDbParameter();System.Data.OleDb.OleDbParameter parameter4 = new System.Data.OleDb.OleDbParameter();
System.Data.OleDb.OleDbParameter parameter5 = new System.Data.OleDb.OleDbParameter();System.Data.OleDb.OleDbParameter parameter6 = new System.Data.OleDb.OleDbParameter();
System.Data.OleDb.OleDbParameter parameter7 = new System.Data.OleDb.OleDbParameter();System.Data.OleDb.OleDbParameter parameter8 = new System.Data.OleDb.OleDbParameter();conn.ConnectionString = "provider=System.Data.SqlClient; Data Source=./SQLEXPRESS;AttachDbFilename=|DataDirectory|/software.mdf;Integrated Security=True;User Instance=True";
command.Connection = conn;
command.CommandText = "INSERT INTO [download_table] (username, computer_name, computer type, install type, date, email, agree, title) VALUES (?,?,?,?,?,?,?,?)";command.CommandType = CommandType.Text;
parameter1.ParameterName = "username";parameter1.DbType = DbType.String;
parameter1.Value = username;
command.Parameters.Add(parameter1);parameter2.ParameterName = "computer_name";parameter2.DbType = DbType.String;
parameter2.Value = computer_name;
command.Parameters.Add(parameter2);parameter3.ParameterName = "comptype";parameter3.DbType = DbType.String;
parameter3.Value = comp_type;
command.Parameters.Add(parameter3);parameter4.ParameterName = "installtype";parameter4.DbType = DbType.String;
parameter4.Value = install_type;
command.Parameters.Add(parameter4);parameter5.ParameterName = "date";parameter5.DbType = DbType.DateTime;
parameter5.Value = date;
command.Parameters.Add(parameter5);parameter6.ParameterName = "email";parameter6.DbType = DbType.String;
parameter6.Value = email;
command.Parameters.Add(parameter6);parameter7.ParameterName = "agree";parameter7.DbType = DbType.String;
parameter7.Value = agree;
command.Parameters.Add(parameter7);parameter8.ParameterName = "title";parameter8.DbType = DbType.String;
parameter8.Value = title;
command.Parameters.Add(parameter8);
try
{
conn.Open();
command.ExecuteNonQuery();
}catch (Exception ex)
{
}
finally
{
conn.Close();
}
}

View 3 Replies View Related







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