Can't Figure Out Error Message In SQL

Oct 16, 2007

Can someone please look at my stored procedure? I am trying to create the following stored procedure, but get the following error
messages:

Msg 102, Level 15, State 1, Procedure InsertWork, Line 3
Incorrect syntax near '7'.
Msg 102, Level 15, State 1, Procedure InsertWork, Line 25
Incorrect syntax near '@7am8am'.

USE [Work]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[InsertWork]
(
  7am8am       nvarchar(500),
  8am9am       nvarchar(500),
  9am10am       nvarchar(500),
  10am11am      nvarchar(500),  
                11am12noon    nvarchar(500),
                12Noon1pm     nvarchar(500),
  1pm2pm       nvarchar(500),
  2pm3pm       nvarchar(500),
  3pm4pm        nvarchar(500),
  4pm5pm       nvarchar(500),  
                5pm6pm       nvarchar(500),
  6pm7pm       nvarchar(500),
  7pm8pm       nvarchar(500),
  8pm9pm        nvarchar(500),
  9pm10pm       nvarchar(500),  
                10pm11pm      nvarchar(500),
  Notes         nvarchar(500),
         Date           nvarchar(15)
)
AS BEGIN
 INSERT INTO WorkDay
 VALUES
                @7am8am,
                @8am9am,
  @9am10am,
  @10am11am, 
  @11am12Noon,
  @12Noon1pm,
  @1pm2pm,
  @2pm3pm,
  @3pm4pm,
  @4pm5pm,
  @5pm6pm,
  @6pm7pm,
  @7pm8pm,
  @8pm9pm,
  @9pm10pm,
  @10pm11pm,
  @Notes,
  @Date
END

 

View 3 Replies


ADVERTISEMENT

Real Figure Instead Of Exponential Figure Needed

May 29, 2008

Hello,

I use OPENROWSET to read values from Excel and store them in a SQL Server table. In the Excel file I have a row having format 'Number' with two decimal places.

Example: 1225000.00

When I select this value using SSMS I get the correct value:

1225000

Strange enough, I cannot see the decimals anymore. However, when I now store this value into my table and then select it from there I get: (the datatype in the table is VARCHAR(max))

1.225e+006

I would not care if I could convert this back to a numeric datatype but this seems not to work: CAST('1.225e+006' as INT) throws an exception. Obviously OPENROWSET sends the data strictly as a character string. Storing this into varchar(max) works for small figures but it starts to use exp values for big figures.

Does anybody has an idea how to bring huge Excel based figures safely into a MS SQL Table ?

Thanks: Peter

View 5 Replies View Related

Including MTD And YTD Figure With A Daily Figure

Feb 4, 2008

Hello,
I have a query that returns a daily revenue figure. The query is as follows:

SELECT top 1000
ds.AcctCode,
ds.TxnDate,
SUM(isnull(ds.FuelFee,0)) + SUM(isnull(ds.CashFee,0)) + SUM(isnull(ds.ScFee,0)) AS TotalDailyRevenue,
--"MTD" = ?,
--"YDT" = ?,
ps.TC,
CASE
WHEN ps.Proj = 100 THEN 'New Account'
WHEN ps.Proj = 200 THEN 'Current Account'
END AS ProjStatus,
ps.FSR,
ps.SubmitRep1

FROM
TxnRptg.dbo.tbl_DailySummary ds
INNER JOIN SalesData.dbo.tbl_CYProcessedSales ps
ON ds.AcctCode = ps.Acct

WHERE
MONTH(ds.TxnDate) = 1
AND
Proj IN (100,200)
AND TC = 'HV'

GROUP BY
ds.AcctCode, ds.TxnDate, ps.TC, ps.Proj, ps.FSR, ps.SubmitRep1

ORDER BY
ds.AcctCode, ds.TxnDate

--*********************************

TxnDate represents a single day of the month. How can I include MTD so that the dates for the revenue total are from DATEADD(mm, DATEDIFF(mm,0,getdate()), 0) (beginning of current month) to TxnDate, and YTD so that the revenue totals are from DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) (beginning of the current year) to TxnDate?


Thank you for your help!


cdun2

View 5 Replies View Related

Can't Figure Out This Error!

Jun 8, 2007

Here is my code below. When I attempt to run the data flow task that calls this script, I get this error:



"Index was outside the bounds of the array."



I honestly do not know what the problem is here. There are definitely 6 columns in the file. In fact, even if comment out everything except the first line (myCol1), I still get the "Index was outside the bounds of the array." error.



Any ideas??? Need help.



Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

Dim rowValues As String()

rowValues = Row.Line.Split(columnDelimiter) 'parse row by comma

If Row.Line Like "*OPENING BALANCE*" Then

Row.AccountNumber = Nothing 'set to null for conditional split

Row.OpeningBalance = CDec(rowValues(3)) 'get the 4th value



ElseIf Row.Line Like "*CLOSING BALANCE*" Then

Row.AccountNumber = Nothing 'set to null for conditional split

Row.ClosingBalance = CDec(rowValues(2)) 'get the 3rd value



Else

Row.myCol1 = CStr(rowValues(0)).Replace("""", String.Empty)

Row.myCol2 = CStr(rowValues(1)).Replace("""", String.Empty)

Row.myCol3 = CStr(rowValues(2)).Replace("""", String.Empty)

Row.myCol4 = CStr(rowValues(3)).Replace("""", String.Empty)

Row.myCol5 = CStr(rowValues(4)).Replace("""", String.Empty)

Row.myCol6 = CDec(rowValues(5))



End If

End Sub

View 10 Replies View Related

Need Help To Figure Out This SqlQueryNotificationService Error.

Mar 30, 2008

I found every several minutes, sometimes one or twice in an hour, I still get a dozen error like below logged in SQL Log. See the error is "You do not have permission to access the service". I found some articles on other errors, but nothing about this error. I want to get more information on this, and a way to trace what is the permission about and which user doesn't have the permission.


Source spid26s

Message
The query notification dialog on conversation handle '{E6FC299F-8BFE-DC11-A4E1-000D5670268E}.' closed due to the following error: '<?xml version="1.0"?><Error xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error"><Code>-8494</Code><Description>You do not have permission to access the service &apos;SqlQueryNotificationService-9ff8b39d-90a8-45bc-83a7-23837920774d&apos;.</Description></Error>'.



thanks

View 7 Replies View Related

SQL Insert Statement Error That I Cannot Figure Out

Dec 11, 2004

I am receiving the following error when trying to insert values from textboxes on a registration form:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30205: End of statement expected.

Source Error:



Line 19: Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Line 20:
Line 21: Dim queryString As String = "INSERT INTO [UserID_db] ([Code], [UserID], [Password], [Email1], [Name_First], [Name_Last], [Admin_level]) VALUES ('" & txtUserID.Text"', '" & txtUserID.Text"', '" & txtPassword.Text"', '" & txtEmail1.Text"', '" & txtFirstName"', '" & txtLastName.Text"', '" & txtAdminLevel.Text"')"
Line 22: Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
Line 23: dbCommand.CommandText = queryString


My code is below. Can anyone help me figure out what is wrong with my code?

<%@ Page Language="VB" Debug="true" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">

Sub btnSubmit_Click(sender As Object, e As EventArgs)

Dim UCde as string = txtUserID.Text
Dim UserID as string = txtUserID.Text
Dim Password as string = txtPassword.Text
Dim Email1 as string = txtEmail.Text
Dim FirstName as string = txtFirstName.Text
Dim LastName as string = txtLastName.Text
Dim AdminLevel as string = dropAccountType.SelectedItem.Value


Dim connectionString As String = "server='(local)'; trusted_connection=true; database='master'"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "INSERT INTO [UserID_db] ([Code], [UserID], [Password], [Email1], [Name_First], [Name_Last], [Admin_level]) VALUES ('" & txtUserID.Text"', '" & txtUserID.Text"', '" & txtPassword.Text"', '" & txtEmail1.Text"', '" & txtFirstName"', '" & txtLastName.Text"', '" & txtAdminLevel.Text"')"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim rowsAffected As Integer = 0
dbConnection.Open()
dbCommand.ExecuteNonQuery()
dbConnection.Close()
End Sub


Thanks for your help.

Chris

View 5 Replies View Related

Is There A Size Limit To This Cause Im Getting An Error That I Cant Figure Out

Mar 14, 2006

I create an sql string as so, add parameters to it and execute it:
string cmdstr = "INSERT INTO locations(id1, id2, companyname, address, city, province, postalcode, phonenumber, faxnumber, contact, contactemail) VALUES (@id1,@id2,@companyname,@address,@city,@province,@postalcode,@phonenumber,@faxnumber,@contact,@contactemail)";
SqlCommand sqlCmd = GetCommandSQL(cmdstr);
sqlCmd.CommandTimeout = TimeOut;
sqlCmd.Parameters.Add("@id1", SqlDbType.Int).Value = itID;
sqlCmd.Parameters.Add("@id2", SqlDbType.Int).Value = Convert.ToInt32(ddlDPCLocation.SelectedValue);
sqlCmd.Parameters.Add("@companyname", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbCompanyName")).Text;
sqlCmd.Parameters.Add("@address", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbAddress")).Text;
sqlCmd.Parameters.Add("@city", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbCity")).Text;
sqlCmd.Parameters.Add("@province", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbProvince")).Text;
sqlCmd.Parameters.Add("@postalcode", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbPostalCode")).Text;
sqlCmd.Parameters.Add("@phonenumber", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbPhoneNumber")).Text;
sqlCmd.Parameters.Add("@faxnumber", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbFaxNumber")).Text;
sqlCmd.Parameters.Add("@contact", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbContact")).Text;
sqlCmd.Parameters.Add("@contactemail", SqlDbType.VarChar).Value = ((TextBox)dvShippingInformation.FindControl("tbContactEmail")).Text;
sqlCmd.ExecuteNonQuery();
for testing purposes ive added the max text in each textbox area, so each textbox has 50 characters or so
and i get an error message as follows, when executing the query:
"System.Data.SqlClient.SqlException: String or binary data would be truncated.
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at _default.InsertGKShippingLocation() in c:\Inetpub\wwwroot\cleanapp\default.aspx.cs:line 125
   at _default.InsertOrder() in c:\Inetpub\wwwroot\cleanapp\default.aspx.cs:line 93
   at _default.InsertandSend() in c:\Inetpub\wwwroot\cleanapp\default.aspx.cs:line 178"
Anybody have any ideas why this is happening

View 1 Replies View Related

Lookup Error How To Figure Out What's Wrong

Mar 19, 2008

I'm new to the SSIS world and am writing my first package. What the package is supposed to do is to take the XML export from one database and import into an identical database (production). There's no connection between the two DBs. During import, the SSIS package checks if there's any primary key values in a table already exist in the production DB and only imports the new records.

So here's the data flow of my package: XML Source -> Lookup -> Conditional Split -> SQL Server Destination. I'm doing a lookup against the same destination DB to check if a record (primary key value) already exists or not, and doing the condition ISNULL(id_out) in the Conditional Split. I really don't know if this is the correct way to implement it. The Lookup control errors out during debugging in Visual Studio. Here's what;s on the progress tab:

[Lookup [1745]] Error: The "component "Lookup" (1745)" failed because error code 0xC020901E occurred, and the error row disposition on "output "Lookup Output" (1747)" specifies failure on error. An error occurred on the specified object of the specified component.

[DTS.Pipeline] Error: The ProcessInput method on component "Lookup" (1745) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.

How do I get more specific error on what went wrong?


Thanks
Bob

View 3 Replies View Related

Checkpoint File Falied During Creation - How To Figure This Error Out

Oct 12, 2007

hi folks,

i have this error when trying to run the package in development mode.
and i can not decipher this non-intuitive message:

Error: 0xC001604D at <package name>: Checkpoint file "" failed during creation due to error 0x80070003 "The system cannot find the path specified.".

please note that i have no checkpoints on package anymore; i had two but i deleted them but this message still appears.
i have searched the web but no luck in finding an answer.

maybe someone would be able to point out my obvious mistake here.

many thanks,

Nicolas

View 1 Replies View Related

DTS Table From Access To SQL, Identity Column Error. Should Be Easy, But I Can't Figure It Out.

Oct 4, 2007



I am trying to move data from Access to SQL Server 2000 using DTS.

I have an Access Source and SQL Server Desitination, My destination table has a field called tableID that is not in the source. TableID is a Primary Key and an Identity column.

I have Enable Identity Insert checked in the options of the Transform Data Task.

When I execute ythe task, I get the error

"Cannot insert the value NULL into column 'TableID'. Does not allow nulls. Insert Fails.

Does anyone know why this simple task would fail?

Mike


View 6 Replies View Related

[File System Task] Error: An Error Occurred With The Following Error Message: Access To The Path Is Denied

Sep 7, 2007

Hi -

I have an File System Task that copies a file from one directory ot another. When I hard code the target directory (c:dirfile.txt) it works fine. When I change it to a virtual directory (\serverdirfile.txt) I get a security error:

[File System Task] Error: An error occurred with the following error message: "Access to the path '\gracehbtest oS2TMM_Live_Title_000002.xml' is denied.".

Where do I change the security settings?

Thanks - Grace

View 5 Replies View Related

[XML Task] Error: An Error Occurred With The Following Error Message: There Are Multiple Root Elements.

Aug 18, 2006

I'm trying to use an XML Task to do a simple XSLT operation, but it fails with this error message:

[XML Task] Error: An error occurred with the following error message: "There are multiple root elements. Line 5, position 2.".

The source XML file validates fine and I've successfully used it as the XML Source in a data flow task to load some SQL Server tables. It has very few line breaks, so the first 5 lines are pretty long: almost 4000 characters, including 34 start-tags, 19 end-tags, and 2 empty element tags. Here's the very beginning of it:

<?xml version="1.0" encoding="UTF-8"?>
<ESDU releaselevel="2006-02" createdate="26 May 2006"><package id="1" title="_standard" shorttitle="_standard" filename="pk_stan" supplementdate="01/05/2005" supplementlevel="1"><abstract><![CDATA[This package contains the standard ESDU Series.]]></abstract>

There is only 1 ESDU root element and only 1 package element.

Of course, the XSLT stylesheet is also an XML document in its own right. I specify it directly in the XML Task:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>

<xsl:template name="identity" match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="kw">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="ihs_cats_seq" select="position()"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>


Its 5th line is the first xsl:template element.

What is going on here? I do not see multiple root elements in either the XML document or the XSLT stylesheet.

Thanks!

View 5 Replies View Related

I Am Getting An Error Message When I Try To Print Using Reporting Services: An Error Occurred During Printing (0x80004005)

May 22, 2007

I am getting an error message when I try to print using reporting services: "an error occurred during printing (0x80004005)"

View 4 Replies View Related

SQL Server Error Message - Operating System Error 10038: An Operation Was Attempted On Something That Is Not A Socket...

Nov 20, 2006

My apologies...I wasn't for sure where to post an error like this...

Over the last 2 months I have gotten this SQL Server error (twice). All existing processes will continue to work, however no new processes can be created and users cannot connect to the server. This is the exact text of the message in the SQL Server error log.

Operating system error 10038: An operation was attempted on something that is not a socket...

Error: 17059, Severity: 18, State: 0

Error accepting connection request via Net-Library 'SSNETLIB'. Execution continuing.

Error: 17882, Severity: 18, State:

While we can typically just stop SQL Server Service and restart the services...I have found it is best to restart the machine during non-production times to take care of any 'residual' effects of this error.

The SQL Server 2000 SP4 box with Windows 2003 Standard SP1 is well maintained by our I.T. team and it typically will run 4 or 5 months without a reboot.



Thank you...

...cordell...

View 5 Replies View Related

Error While Calling The Roles.AddUserToRole (error Message: Cannot Resolve Collation Conflict For Equal To Operation)

Feb 5, 2006

Hi, I have developed a website in asp.net 2. I have tester it and it is working fine on my computer but when I have uploaded it to my server I'm getting an error message when the user signup. The error occurs when I'm setting the user role to 'members'.
 
Error line > Roles.AddUserToRole(user.UserName, "members")
 
The strage thig is that it is working on my computer but not on the server. My home computer and the server are running the same software versions and the website database is the same as well.
 
To double check that my code is not generating the error I have lonched 'SQL Query Analizer' and executed the folowing code on my database:
NOTE: In my database I have create the user “teeluk12� and a role “members�
 
aspnet_UsersInRoles_AddUsersToRoles "/", "teeluk12", "members", "5/02/2006 4:44:33 pm"
 
Once again the code is working on my home computer but not on the server. On the server I'm getting the following error:
 
Server: Msg 446, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 76
Cannot resolve collation conflict for equal to operation.
 
 
 
Does anybody know what could cause the error?
Could it be some permissions that I didn't set on my server?
 
 
Thanks for my help and suggestions...
Regards,
Gonzal
 

View 9 Replies View Related

Famous Named Pipes Provider, Error 40 Error Message

Oct 18, 2007

Trying to connect to remote server croaktoad.simpli.biz
I have SQL 2005 Developer on XP SP2 , I have disabled my windows firewall. I can ping to my server (croaktoad.simpli.biz) and i get no error message. My remote connection using both TCP/IP and named pipes are checkeed. My SQL Server Browser is running as well.

However when I try to connect using Managment Studio or running SQLCMD /Scroaktoad. simpli.biz /E I get the following error message

C:sqlcmd /Scroaktoad.simpli.biz /E
HResult 0x52E, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [1326].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired


So I've read all the forums for past 2 days and tried everything, nothing changed Any ideas?

View 4 Replies View Related

Error List With Appropriate Error Number And Error Message

Oct 10, 2007

where can i find it?

thanks

View 4 Replies View Related

Error Message: Error 0x800706BE While Loading Package File D:PackagesToradSales.dtsx. The Remote Procedure Call Failed.

Dec 20, 2006

Hello,

I have a bundling package that runs about 20 other packages. It has been working fine for a while but a couple of days ago it fail with the following message,

Error 0x800706BE while loading package file "D:PackagesToradSales.dtsx". The remote procedure call failed.

I´m running the SSIS packages in an 64-bit environment.

Thankful for help with this!

//Patrick

View 3 Replies View Related

SQLSTATE 42000] (Error 7391) Error Message

Nov 5, 2007



I'm not sure if this is the correct group for this messages, but here it is anyway.

I have a job that has 3 steps to, periodicly the job errors out on Step 1. Following is the message (from Job History).

--------------------

Executed as user: SMIsqladmin. The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction. [SQLSTATE 42000] (Error 7391) [SQLSTATE 01000] (Error 7312) OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a]. [SQLSTATE 01000] (Error 7300). The step failed.
--------------------




Can someone please explain this message, I have no idea how to fix it or what the cause is.

Thanks

David Davis

View 1 Replies View Related

SQL Error Message

Oct 19, 2007

I have a SQL Express database on our server that is used for one of our websites when the website tries to write to the database I get the following error: -
An attempt to attach an auto-named database for file D:lahwebsitesGiants North Walesapp_datadatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
This error is very frustrating and I really can't find a way around it.  I have done the following: -


Deleted the SQL Server Express folders under user preferences

View 3 Replies View Related

Error Message

Feb 29, 2008

Hi,I am trying to write some C# ASP.NET 2.0 code. I have created a web form to send data to my sql server 2005 database. When I compile the application and insert data then click on the submit button I get this error 

"A first chance exception of type
'System.Data.SqlClient.SqlException' occurred in System.Data.dll" I have been trying to solve this for a few days now with no luck, so any help would be appreciated. I'll post below the source code of the web form (addOrder.aspx). It might be worth mentioning that I have created another web form in the same project called addCustomer.aspx. Like addOrder.aspx it is a web form, however it successfully inserts data in the database.  1 <%@ Page Language="C#" MasterPageFile="~/Default.master" Title="Add Order Page" %>
2 <%@ import namespace="System.Data.SqlClient" %>
3 <%@ Import Namespace="System.Data" %>
4 <%@ Import Namespace="System.Web" %>
5 <%@ Import Namespace="System.Configuration"%>
6 <%@ Import Namespace="System.Globalization"%>
7
8 <script runat="server">
9
10 protected void Page_Load(object sender, EventArgs e)
11 {
12
13 }
14
15 protected void sumbitButton_Click(object sender, EventArgs e)
16 {
17 SqlConnection conn;
18 SqlCommand comm;
19 string connectionString =
20 ConfigurationManager.ConnectionStrings[
21 "ShippingSystemConnectionString1"].ConnectionString;
22 conn = new SqlConnection(connectionString);
23 comm = new SqlCommand(
24 "INSERT INTO Order(CustomerID, " +
25 "NumberofItems, DescriptionsofItems, SafeItems) " +
26 "VALUES (@CustomerID, " +
27 "@NumberofItems, @DescriptionsofItems, @SafeItems)", conn);
28 comm.Parameters.Add("@CustomerID", System.Data.SqlDbType.Int);
29 comm.Parameters["@CustomerID"].Value = int.Parse(DropDownList1.SelectedValue);
30 comm.Parameters.Add("@NumberofItems", System.Data.SqlDbType.Int);
31 comm.Parameters["@NumberofItems"].Value = numofitemstxt.Text;
32 comm.Parameters.Add("@DescriptionsofItems", System.Data.SqlDbType.VarChar);
33 comm.Parameters["@DescriptionsofITems"].Value = descofitemstxt.Text;
34 comm.Parameters.Add("@SafeItems", System.Data.SqlDbType.VarChar);
35 comm.Parameters["@SafeItems"].Value = safetxt.Text;
36 try
37 {
38 conn.Open();
39 comm.ExecuteNonQuery();
40 Response.Redirect("Success.aspx");
41 }
42 catch
43 {
44 }
45 finally
46 {
47 conn.Close();
48 }
49 }
50
51
52
53 protected void CustomerIDList_SelectedIndexChanged(object sender, EventArgs e)
54 {
55
56 }
57 </script>
58
59 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
60 <table style="position: static">
61 <tr>
62 <td style="width: 169px">
63 Customer ID:</td>
64 <td style="width: 100px">
65 <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
66 DataTextField="CustomerID" DataValueField="CustomerID" Style="position: static">
67 </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShippingSystemConnectionString1 %>"
68 SelectCommand="SELECT [CustomerID] FROM [Customer]"></asp:SqlDataSource>
69 </td>
70 <td style="width: 178px">
71 </td>
72 </tr>
73 <tr>
74 <td style="width: 169px">
75 Number of Items:</td>
76 <td style="width: 100px">
77 <asp:TextBox ID="numofitemstxt" runat="server" Style="position: static"></asp:TextBox></td>
78 <td style="width: 178px">
79 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="numofitemstxt"
80 ErrorMessage="Number of Items Required" Style="position: static"></asp:RequiredFieldValidator></td>
81 </tr>
82 <tr>
83 <td style="width: 169px">
84 Descriptions of Items:</td>
85 <td style="width: 100px">
86 <asp:TextBox ID="descofitemstxt" runat="server" Style="position: static"></asp:TextBox></td>
87 <td style="width: 178px">
88 <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="descofitemstxt"
89 ErrorMessage="Description Required" Style="position: static"></asp:RequiredFieldValidator></td>
90 </tr>
91 <tr>
92 <td style="width: 169px">
93 Are Items safe:</td>
94 <td style="width: 100px">
95 <asp:TextBox ID="safetxt" runat="server" Style="position: static"></asp:TextBox></td>
96 <td style="width: 178px">
97 <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="safetxt"
98 ErrorMessage="Are Items Safe?" Style="position: static"></asp:RequiredFieldValidator></td>
99 </tr>
100 <tr>
101 <td style="width: 169px">
102 <asp:ValidationSummary ID="ValidationSummary1" runat="server" Style="position: static" />
103 </td>
104 <td style="width: 100px">
105 <asp:Button ID="sumbitButton" runat="server" OnClick="sumbitButton_Click" Style="position: static"
106 Text="Submit" /></td>
107 <td style="width: 178px">
108 </td>
109 </tr>
110 </table>
111 </asp:Content>
112
113
  My order table in SQL server 2005 (express) looks like this:  

View 5 Replies View Related

Sql Error Message

Jan 27, 2004

Hello-

I have the following sql statement which produced an error when I add the order by clause

SQL = "SELECT DISTINCT nc_department.department, Count(nonconformance.department_id) as 'events', ISNULL(SUM(nonconformance.nc_wafer_qty),0) as wafers FROM nc_department LEFT OUTER JOIN nonconformance ON nc_department.department_id = nonconformance.department_id WHERE nc_department.active = '1' GROUP BY nc_department.department ORDER by nc_department.order_id"


This is the error I get:

ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

Any help appreciated

View 10 Replies View Related

Error Message?

Apr 23, 2004

I'm catching a primary constraint error in SQL and don't want to return the SQL error message back to the client. Is there any way to stop this. Thankyou

View 5 Replies View Related

Error Message

May 21, 2004

I need help on this!
When I try to change the data from a table using Web Matrix, then I get this error message.

The table’s data cannot be edited because the table does not contain modifiable columns.

As I need to edit the data’s, how can I solve this?


Thanks for Your Help
Mikel

View 1 Replies View Related

Error Message

Sep 8, 2004

I finally installed MSDE and have the icon in my tray at the bottom of the screen.
When I try to connect to a database using the wizard in the web matrix program I get this message:
Unable to connect
SQL Server does not exist of access denied
Connection Open (Connect ())
What might be wrong??
Thanks for your help I'll get it soon (I hope)
Del Dobbs

View 2 Replies View Related

SQL Error Message

Dec 17, 2004

HI FRIENDS

WHEN I TRY TO RUN A PROGRAM WHICH BINDS A DATAGRID CONTROL TO A SQL SERVER TABLE I GET A ERROR MESSAGE LIKE [SQL EXECEPTION LOGIN FAILED FOR HOMECOMPUTER/ASPNET] . IF U KNOW WHAT MIGHT COZ THE PROBLEM PLEASE TELL ME.

IAM RUNNING THE MICROSOFT SQL SERVER FORM MY HOME COMPUTER I.E (LOCAL) . IS THERE SOME SETTINGS THAT I NEED TO DO BEFORE RUNNING A PAGE WHICH CONNECTS TO THE SQL SERVER.

View 2 Replies View Related

SQL Error Message Help

Jun 13, 2006

I am trying to set a text field as the primary key for a SQL SERVER Express 2005 Database in Visual Studio. I used the following Command:ALTER TABLE Tablename ADD PRIMARY KEY (fieldname);where you substitute table name and fieldname for the appropriate fields. The error message I am getting is:SQL Execution Error.Executed SQL statement: ALTER TABLE Lake ADD PRIMARY KEY(wbic);Error Source .Net SqlClient Data ProviderError Message: Column 'wbic' in table Lake is of a type that is invalid for use as a primary key column or index.Could not create constraint. See previous errors.How can I fix this so any type of field can be a primary key?

View 7 Replies View Related

Help With Error Message

Feb 7, 2002

I am extracting data out of Lotus Notes into an Oracle DB using EM.
I keep getting an error "[Lotus][ODBC Lotus Notes] Data value is not a valid date, time or timestamp" I went ahead and dropped the destination table, and changed all of the "date" columns to varchar's, redefined the transformation, and executed package again, but still get the error. Any ideas?

Thanks!
BV

View 1 Replies View Related

Error Message....

Jun 20, 2001

Has anyone seen these error messages.....

17066: SQL Server Assertion: File: <proc.c>, line=1927
Failed Assertion = 'm_activeSdesList.Head () == NULL'.

and

1203, Severity: 20 State: 1
Process ID 8 attempting to unlock unowned resource KEY:
7:1402200252:6 (f80117756d42).

View 2 Replies View Related

Error Message

Oct 18, 2001

I am running across this error message: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

Has anyone seen this before? Can you perform a fetch or do a loop? I am kind of new at sql and not really sure how either of these work or how to start to code something like that.

Thanks!
Terry

View 2 Replies View Related

I Got Error Message

Oct 26, 2000

When I ran below stored procedure, I got error message.

create procedure pro_log
as
declare@Execution_String varchar(255),
@logfilevarchar(112)
select@logfile = 'server_name(F:)folder_namelog_name'+convert(varc har(8),getdate(),112)+'.log'
Select @Execution_String = '(F):Mssql7Binnisql -S server_name -U user_name -P password -d datebase_name -q"procedure_name" > ' + @logfile
Print @Execution_String
Execute master..xp_cmdshell @Execution_String
return
GO
exec pro_log

************************************************** *************************
Mssql7Binnisql was unexpected at this time.

(1 row(s) affected)
************************************************** *************************

Any body can please tell me what is meant by above error message?

View 5 Replies View Related

Help On This Error Message

Jan 10, 2001

I am running a program on SQL 6.5 server and I am getting this error message:

Can't allocate space for object '-451' in database 'tempdb' because the 'system' segment is full. If you ran out of space in Syslogs, dump the transaction log. Otherwise, use ALTER DATABASE or sp_extendsegment to increase the size of the segment. Sort failed: Out of space or locks in database 'tempdb'

Can somebody help me resolve this error message? Thanks a lot

Isabel

View 1 Replies View Related

Error Message

Nov 16, 2001

hi,
i am getting the following error message whenever i run my sql server. the error message is
================================================== ========

The ODBC resource DLL(c:WINNTsystem32odbcint.dll) is a different
version than the ODBC driver manager (C:winntsystem32ODBC32.dll)

You need to reinstall the ODBC components to ensure proper operation.
================================================== ===========
i also get the foll message while starting the windows also

================================================== ==========
msdtc.exe entry level not found
================================================== ==========

can anyone tell me what should i do to rectify this problem

regards
prady

View 2 Replies View Related







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