Adding Dashes To Ssn
May 30, 2008
Can anyone help with this. IF i have a ssn like 123459636 and i want to insert dashes into it how would i do that. Results would be 123-45-9636
The second problem is that some of the ssn dont have zero in them so some look like 1234567 i would have to pad with zero then trim from the right to 9 digits then insert the dashes not sure how to do that
results would be 001-23-4567
View 7 Replies
ADVERTISEMENT
Apr 8, 2008
Hi!
I run a query that returns strings that look like this: 08-07, 06-07,04-05 etc. But when I copy the query outuput from Management Studion in SS2005 into Excel 2003, strings get converted into custom dates such as 8-Jun, 9-Jul, 4-May etc in Excel. Is there anthing I can do in T-SQL to prevent this conversion? The strings are set as char(5) datatype in a T-SQL view.
Thanks.
View 8 Replies
View Related
May 29, 2008
Hi,
In a extract that i have the SS# is as 123-45-6789 how do i remove the dashes in the string and have the final expression of 123456789.
thanks
Karen
View 3 Replies
View Related
Oct 12, 2007
Hi,I have a large table with a 'datetime' column that has date and timevalues in it. The data is in this format:2007-10-02 09:54:00.000The table is called 'profile' and the column 'msgdate'I want to return only rows that match a specific date. So far I havethe following query working:select * from profile where msgdate like '%2007%'This returns all rows that start with '2007'. However I cannot seem toge the syntax that will allow me to return a specific date, e.g.2007-10-02I have researched this, trying all sorts of queries with escapecharacters/sequences because of the dash character, but I cannot getit to return anything. Most of my queries have ran without error, itsjust that no data is returned.James
View 2 Replies
View Related
Aug 8, 2007
when i do a bulk insert with dashes (i.e. one - two), i get the character u with two dots above it ( Ü ) in place of all the dashes? can't seem to figure out why. the field terminator is a comma ( , ).
i'm inserting just text with dashes into char(75) field.
can someone explain and provide a solution? i would greatly appreciate it!
my script is quite simple, maybe i'm missing something.
Code Snippet
bulk insert testtable
from '\localc$adjust.txt'
with (fieldterminator = ',')
thanks!
View 1 Replies
View Related
Nov 8, 2006
Ok. Here is a weird problem.
I have a package which contains a variable with the value of a UNC sharename. The hostname in the share contains dashes.
I am trying to create a SQL Agent entry to execute said package. Because the package is now in production I want to pass in a new value for the sharename variable. I use the SQL @@SERVERNAME variable to build the package command. (Notice the BlotterUploadFolder variable at the end.)
SELECT @command = N'/FILE "\' + @@SERVERNAME + 'PackagesMiddleOfficeReconcilliationImportManualBlotter_AccountTransfers.dtsx" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING EW /CONNECTION MiddleOfficeDb;"Data Source=' + @@SERVERNAME + ';Initial Catalog=MiddleOffice;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;" /SET package.variables[BlotterUploadFolder].Value;\' + @@SERVERNAME + 'ManualBlottersUploads'
If I print the @command variable right after setting it, I get what I expect.
/FILE "\PRD-NY-DB-01PackagesMiddleOfficeReconcilliationImportManualBlotter_AccountTransfers.dtsx" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING EW /CONNECTION MiddleOfficeDb;"Data Source=PRD-NY-DB-01;Initial Catalog=MiddleOffice;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;" /SET package.variables[BlotterUploadFolder].Value;\PRD-NY-DB-01ManualBlottersUploads
If I cut-paste this into cmd window and execute it with DTExec.exe the package works fine. But when I run the schedule task it causes an error. When I go into the Job Properties dialog to look at the step, I see the value (in the "Set values" table) set to \PRD instead of \PRD-NY-DB-01.
If I modify the SELECT command above to put double-quotes around the value, the value is correct in the Job Properties dialog but causes an error when I exec it with DTExec.
/FILE "\PRD-NY-DB-01PackagesMiddleOfficeReconcilliationImportManualBlotter_AccountTransfers.dtsx" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING EW /CONNECTION MiddleOfficeDb;"Data Source=PRD-NY-DB-01;Initial Catalog=MiddleOffice;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;" /SET package.variables[BlotterUploadFolder].Value;"\PRD-NY-DB-01ManualBlottersUploads"
causes the error
Option "-NY" is not valid.
Hopefully somebody has an idea of what is going on.
Thanks.
- Jason
View 3 Replies
View Related
Jul 23, 2005
Hi,I'm having trouble running the following query:select * from message where text_body like ' ----------%'ie, five spaces followed by at least ten hyphens. The query doesn'tcomplete, so eventually I cancel it. If I remove the hyphens from thequery ("... like ' %'") then it runs fine (though it doesn't findthe correct data).Am I confusing SQL Server by using a wildcard or regular expression?(I'm using SQL Server 2000 - 8.99.760).Thanks in advance for any helpRichard
View 5 Replies
View Related
Jul 23, 2005
Hello,I have had a request, one of our tables is used as a report and I have beenasked that all fieldnames for months have dashes in them,like Jan-05 instead of Jan05 and so on...Now what we have is a CURSOR which loops through all values in another tablegenerating these fieldnames, like 'Jan-05', Feb-05' etc..Then the table definition is modified so these months display as fieldnames.That is fine,Except later it calls another stored procedure which inserts values fromanother table into this one.INSERT INTO TableNameSELECT *FROM TablenameObviously this is failing because the newly amended table now has dashes inthe fieldnames now.Now as the fieldnames are created dynamically I cannot simply do INSERTTablename ([Jan-05], [feb-5]) etc, as one would normally do,How could I do this bearing in mind its not always going to be 12 months weuse,Basically I am asking how can I modify this INSERT statement so it takesinto account the fieldnames with dashes in themBearing in mind I don't know what the fieldnames are called as they arecreated dynamically by a CURSOR in a different routine.And its not always 12 months.have you any ideas?and the dashes are requiredJayne
View 4 Replies
View Related
Jul 20, 2005
Hi all,I have a table in the DB which holds ISBN book nubers .. which, as you knowhave dashes (examlple: 0-98765-8-9).When I run a query from an ASP page to find the number, it doesn't returnanything:sISBN = "0-98765-8-9"OpenSQL(select URL from ISBN_Redirect where ISBN=" & sISBN )Can you give me a hind of what I am doing wrong?Thanks so much in advance.S
View 1 Replies
View Related
Jun 29, 2007
Using the "set values" tab, I am trying to set the values of package variables to strings that contain spaces and/or dashes. If I run the package using the integrations services server, it runs perfectly. If I schedule the package on SQL Server agent, I get the following error.
"Executed as user: GBPSQLServer. Microsoft (R) SQL Server Execute Package Utility Version 9.00.3042.00 for 64-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Option "-restofstring" is not valid. The command line parameters are invalid. The step failed."
Looking at the command line generated by the SQL Agent interface, the value is quoted using double quotes like this:
/SQL "PackageName" /SERVER SQL1 /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /SET "Package.Variables[LogFolder].Value";"\remoteservernameinetpub he-restofstring
estofstring" /REPORTING E
It seems that the command line parser is not recognising the quotes, or maybe the slashes are throwing it off, or sql server agent is doing something funny to the command line before it executes it.
Anybody got any ideas?
View 1 Replies
View Related
Sep 14, 2015
I have created a job which executes a procedure which executes and creates logs of StartTime and EndTime and records affected. The last step of the job sends mails to recipients from the logs table. Though I get the info correctly I get all annoying dashes for 4-5 lines between each line of message. How to remove the dashes.
Below is the code i use to send mails.
EXEC msdb.dbo.sp_send_dbmailÂ
 @profile_name='SQL Mail Service',
 @recipients='biscribbler@gmail.com',
 @copy_recipients='biscribbler@gmail.com',
 @subject='SOFT SCRUB Completed for LiveDB',
[Code] ....
View 2 Replies
View Related
Apr 10, 2006
I have imported a package using SSIS into the Maintenance Plan folder from another server.
It imports fine, but when i Modify the package then click save I get the following error : 'Guid should contain 32 digits with 4 dashes'.
This has been reported on other forums without resolution.
Pete
View 17 Replies
View Related
Sep 3, 2015
Is there any way or option to get the all columns of dataset added to table when we add a table in data region. It will take lot of time to add one by one and also there are chances to add one column ore than once.
View 7 Replies
View Related
Aug 6, 2013
What is the syntax for adding a column where you are adding a year to a date in a date format? For example adding a column displaying a year after the participation date in date format?
View 1 Replies
View Related
Jan 2, 2007
hey i have a very simple form here: www.syscpupower.com
I would like to have the information from the form saved to a sql db with a time stamp.
here is the code i have for the page below:"C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
"server">
"form1" runat="server">
"z-index: 108; left: 0px; position: absolute; top: 189px">
"z-index: 109; left: 204px; width: 411px; position: absolute; top: 18px;
height: 160px">
"3" rowspan="3" style="text-align: center"> Please accept to view your detailed trip information.
"Button1" runat="server" OnClick="Button1_Click" Style="z-index: 102;
left: 322px; position: absolute; top: 261px" Text="Accept" Width="60px">
"Button2" runat="server" OnClick="Button2_Click" Style="z-index: 103;
left: 392px; position: absolute; top: 261px" Text="Decline" Width="64px">
"Label1" runat="server" Style="z-index: 104; left: 254px; position: absolute;
top: 198px" Text="Please Enter Your First and Last Name!" Width="273px">
"TextBox1" runat="server" Style="z-index: 105; left: 278px; position: absolute;
top: 229px" Width="216px">
"RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="FirstName LastName" Font-Size="12px" Style="z-index: 106; left: 500px;
position: absolute; top: 229px">*
"ValidationSummary1" runat="server" Style="z-index: 110;
left: 263px; position: absolute; top: 300px" Width="284px">
View 5 Replies
View Related
Nov 27, 2007
Hello
A
B
C
D
1
230
40
190
190
2
470
194
276
466
3
376
328
48
514
4
558
340
218
732
5
447
483
-36
696
6
218
357
-139
557
7
395
414
-19
538
8
264
375
-111
427
9
214
285
-71
356
10
218
251
-33
323
In the above table I am looking to replicate column D in sql, columns A,B and C are already generated by the sql.
D is currently done in Excel using =D1 + C2 which is in spot D2.
Can this be done in sql? Does anyone have an example. I am looking to do it in a select query if possible.
Thanks
View 3 Replies
View Related
Oct 16, 2006
I have a details view with several parameters set up in my asp.net 2.0 code, I want to add a parameter before the sql parameter is executed. I need to use the find control of the details view because I am using items/edit item templates in my details view control. I tried this(see below) as well as the detailsview item command event args to no avail. It doesn't see the other parameters that have already been declared in my asp.net code. I don't want to have to declare all my varibles that are already in my asp.net code. I just want to add another parameter. Sub InsertNew(ByVal sender As Object, ByVal e As DetailsViewInsertEventArgs) _ Handles dvEvents.ItemInserting Dim dvr As DetailsViewRow For Each dvr In dvEvents.Rows Dim CatIDup As Integer = CType(dvr.FindControl("ddlCat"), DropDownList).SelectedValue sdsevents.InsertParameters.Add("evCatID", CatIDup)sdsevents.Insert()
View 4 Replies
View Related
Dec 4, 2006
Looking for any help someone can offer on adding an image to SQL.Working on what will hopefully be quite a big site and the user will be asked for some details, one of which will be an image (jpg, gif or bmp).Rather than add the image to a folder on the server, a folder which could end up being quite large, I was hoping someone could give me some help, suggestions or even point me towards a tutorial on how to store the image in an SQL database.Any helps appreciated, thanks :)
View 2 Replies
View Related
Apr 19, 2007
Hi Everyone,
I have a page with a textbox and a dropdown list. The user will enter a company name in the text box and select a number from 1 - 20 (number of delegates for that company) in the dropdown list.
I've got the text box and dropdown writing to tblCompany but I would also like it to write to tblUsers at the same time. The reason for this is that i need it to set up the number of users that have been selected in the dropdown list.
Here is the codebehind file:Imports System.Data.SqlClient
Imports System.Web.Configuration
Partial Class cms_Management_Company_NewCompany
Inherits System.Web.UI.Page
Dim companyName As String
Dim companyActive As Boolean
Dim companyArchived As Boolean
Dim companyDelegates As Integer
Dim userForeName As String
Dim userSurname As String
Dim userEmail As String
Dim userUsername As String
Dim userPassword As String
Dim userActive As Boolean
Dim userTypeID As Integer
Dim companyID As Integer
Dim i As Integer
Dim NoLoops As Integer
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSave.Click
Dim conString As String = WebConfigurationManager.ConnectionStrings("General").ConnectionString
Dim con As New SqlConnection(conString)
Dim cmd As New SqlCommand("INSERT INTO tblCompany (CompanyName, CompanyActive, CompanyArchived, CompanyDelegates) VALUES (@CompanyName, @CompanyActive, @CompanyArchived, @CompanyDelegates)", con)
cmd.Parameters.AddWithValue("@CompanyName", companyName)
cmd.Parameters.Item("@CompanyName").Value = txtCompanyName.Text
cmd.Parameters.AddWithValue("@CompanyDelegates", companyDelegates)
cmd.Parameters.Item("@CompanyDelegates").Value = lstDel.SelectedValue
cmd.Parameters.AddWithValue("@CompanyActive", companyActive)
cmd.Parameters.Item("@CompanyActive").Value = True
cmd.Parameters.AddWithValue("@CompanyArchived", companyArchived)
cmd.Parameters.Item("@CompanyArchived").Value = False
Using con
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
Dim con2 As New SqlConnection(conString)
Dim cmd2 As New SqlCommand("INSERT INTO tblUsers (UserForeName, UserSurname, UserEmail, UserUsername, UserPassword, UserActive, UserTypeID, CompanyID) VALUES (@UserForeName, @UserSurname, @UserEmail, @UserUsername, @UserPassword, @UserActive, @UserTypeID, @CompanyID)", con2)
cmd2.Parameters.AddWithValue("@UserForeName", userForeName)
cmd2.Parameters.Item("@UserForeName").Value = "First Name - Delegate 1"
cmd2.Parameters.AddWithValue("@UserSurname", userSurname)
cmd2.Parameters.Item("@UserSurname").Value = "Surname - Delegate 1"
cmd2.Parameters.AddWithValue("@UserEmail", userEmail)
cmd2.Parameters.Item("@UserEmail").Value = "Email Address - Delegate 1"
cmd2.Parameters.AddWithValue("@UserUsername", userUsername)
cmd2.Parameters.Item("@UserUsername").Value = "Username - Delegate 1"
cmd2.Parameters.AddWithValue("@UserPassword", userPassword)
cmd2.Parameters.Item("@UserPassword").Value = "Password - Delegate 1"
cmd2.Parameters.AddWithValue("@UserActive", userActive)
cmd2.Parameters.Item("@UserActive").Value = True
cmd2.Parameters.AddWithValue("@UserTypeID", userTypeID)
cmd2.Parameters.Item("@UserTypeID").Value = 2
cmd2.Parameters.AddWithValue("@UserTypeID", userTypeID)
cmd2.Parameters.Item("@UserTypeID").Value = 1
Using con2
con2.Open()
For i = 1 To NoLoops
cmd2.ExecuteNonQuery()
Next i
con2.Close()
End Using
Response.Redirect("~/cms/Management/Company/Company.aspx")
End Sub
End ClassThe other thing I am not sure of is getting the ID of the new company and assiging it to the delegates in tblUsers (to associate them with the new company)I hope this makes sense.Thank you very much guys.Scott.
View 2 Replies
View Related
Aug 25, 2007
I am trying to insert a value numeric + 1 in to db table but i get error when i do this
this is the code
Const SQL As String = "INSERT INTO [PageHits] ([DefaultPage]) VALUES (@defaultP)"Dim myCommand As New Data.SqlClient.SqlCommand(SQL, myConnection)myCommand.Parameters.AddWithValue("@DefaultP" + "1", DefaultP.Text.Trim())
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
The Error:
Must declare the variable '@defaultP'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Must declare the variable '@defaultP'.
View 1 Replies
View Related
Sep 14, 2007
i want to add vales in a query
this is my scenario (how can i add the price column values and display as one record) ex. 222 17
table = table1
tep1 price (column)
222 5
222 2
222 10
View 2 Replies
View Related
Oct 2, 2007
Hi all,
I have a database setup with a few rows and i would like to allow a user to create a new row of data. After some googling, I've deduced that I need to somehow use an onclick command to perform an insert command. here is my code as of right now:
protected void ItemAdd_Click(object sender, EventArgs e)
{int newnum = 4;int POnum = newnum ++;
string Item = textbox3.Text.ToString();
string Quantity = textbox4.ToString();string Part = textbox5.ToString();
string Description = textbox6.Text.ToString();string Price = textbox7.Text.ToString();string UOM = textbox8.Text.ToString();
SqlDataSource2.InsertParameters.Clear();
SqlDataSource2.InsertParameters.Add("@Item", Item);SqlDataSource2.InsertParameters.Add("@Quantity", Quantity);
SqlDataSource2.InsertParameters.Add("@Part", Part);SqlDataSource2.InsertParameters.Add("@Description", Description);
SqlDataSource2.InsertParameters.Add("@Price", Price);SqlDataSource2.InsertParameters.Add("@UOM", UOM);
SqlDataSource1.InsertCommand = "insert into ItemMaster "+"values (12, @Item, @Quantity, @Part, @Description, @Price, @UOM)";
SqlDataSource2.Insert();
}
here's the aspx:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="createpo.aspx.cs" Inherits="Subpgs_Purchasing_createpo" Title="Create A PO" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width: 600px; position: relative; top: 30px; height: 253px" cellpadding="10px">
<tr>
<td style="width: 180px; text-align: left;" rowspan="2">
Select Vendor<br />- or -<br /><asp:LinkButton ID="Linkbutton1" runat="server" OnClick="Linkbutton1_Click">Create Vendor</asp:LinkButton></td>
<td style="width: 100px" rowspan="2">
<asp:ListBox ID="ListBox2" runat="server" DataSourceID="SqlDataSource1" DataTextField="Name"
DataValueField="ID" OnSelectedIndexChanged="ListBox2_SelectedIndexChanged"></asp:ListBox><asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [Vendor_info]"></asp:SqlDataSource>
</td>
<td style="width: 180px; text-align: left;">
Job/Req.S.O. No.</td>
<td style="width: 100px">
<asp:TextBox ID="Job" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 180px; text-align: left;">
Terms</td>
<td style="width: 100px">
<asp:TextBox ID="Terms" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 180px; text-align: left;">
F.O.B.</td>
<td style="width: 100px">
<asp:TextBox ID="FOB" runat="server"></asp:TextBox></td>
<td style="width: 180px; text-align: left;">
Ship To:<br />
Address:<br />
City / State / Zip:</td>
<td style="width: 100px">
<asp:TextBox ID="Ship1" runat="server"></asp:TextBox>
<asp:TextBox ID="Ship2" runat="server"></asp:TextBox>
<asp:TextBox ID="Ship3" runat="server"></asp:TextBox></td>
</tr>
</table>
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Purchase_Orders.mdf;Integrated Security=True;User Instance=True;Context Connection=False"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT [Item], [Quantity], [Part], [Description], [Price], [UOM], [Ammount], [PONumber] FROM [ItemMaster]" DeleteCommand="DELETE FROM [ItemMaster] WHERE [PONumber] = @PONumber" InsertCommand="INSERT INTO [ItemMaster] ([Item], [Quantity], [Part], [Description], [Price], [UOM], [Ammount], [PONumber]) VALUES (@Item, @Quantity, @Part, @Description, @Price, @UOM, @Ammount, @PONumber)" UpdateCommand="UPDATE [ItemMaster] SET [Item] = @Item, [Quantity] = @Quantity, [Part] = @Part, [Description] = @Description, [Price] = @Price, [UOM] = @UOM, [Ammount] = @Ammount WHERE [PONumber] = @PONumber">
<DeleteParameters>
<asp:Parameter Name="PONumber" Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Item" Type="String" />
<asp:Parameter Name="Quantity" Type="Decimal" />
<asp:Parameter Name="Part" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Price" Type="Decimal" />
<asp:Parameter Name="UOM" Type="String" />
<asp:Parameter Name="Ammount" Type="Decimal" />
<asp:Parameter Name="PONumber" Type="Decimal" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Item" Type="String" />
<asp:Parameter Name="Quantity" Type="Decimal" />
<asp:Parameter Name="Part" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Price" Type="Decimal" />
<asp:Parameter Name="UOM" Type="String" />
<asp:Parameter Name="Ammount" Type="Decimal" />
<asp:Parameter Name="PONumber" Type="Decimal" />
</InsertParameters>
</asp:SqlDataSource>
<br />
<table>
<tr>
<td>Item #</td>
<td><asp:TextBox ID="textbox3" runat=server></asp:TextBox></td>
<td>Quantity</td>
<td><asp:TextBox ID="textbox4" runat=server></asp:TextBox></td>
<td>Part Number</td><td><asp:TextBox ID="textbox5" runat=server></asp:TextBox></td>
</tr>
<tr>
<td>Description</td>
<td><asp:TextBox ID="textbox6" runat=server></asp:TextBox></td>
<td>Unit Price</td>
<td><asp:TextBox ID="textbox7" runat=server></asp:TextBox></td>
<td>Unit of Measure</td>
<td><asp:TextBox ID="textbox8" runat=server></asp:TextBox></td>
</tr>
<tr>
<td colspan="6" align="center"><asp:Button ID="ItemAdd" runat=server text="Add Item" OnClick="ItemAdd_Click" /></td>
</tr>
</table>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="PONumber"
DataSourceID="SqlDataSource2">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" />
<asp:BoundField DataField="Part" HeaderText="Part" SortExpression="Part" />
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<asp:BoundField DataField="UOM" HeaderText="UOM" SortExpression="UOM" />
<asp:BoundField DataField="Ammount" HeaderText="Ammount" SortExpression="Ammount" />
<asp:BoundField DataField="PONumber" HeaderText="PONumber" ReadOnly="True" SortExpression="PONumber"
Visible="False" />
</Columns>
</asp:GridView>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Submit Data" OnClick="Button1_Click" /> <br />
<br />
<asp:Label ID="Label1" runat="server" Text="Please Verify Information below!" Visible="False"></asp:Label><br />
<br />
<table align="left">
<tr>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label4" runat="server" Text="Job/REQ.S.O. No." Visible="false"></asp:Label></td>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label5" runat="server"></asp:Label></td>
</tr>
<tr>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label7" runat="server" Text="Terms" Visible="false"></asp:Label></td>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label8" runat="server"></asp:Label></td>
</tr>
<tr>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label10" runat="server" Text="F.O.B." Visible="false"></asp:Label></td>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label11" runat="server"></asp:Label></td>
</tr>
</table>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1"
Height="50px" Visible="False" Width="260px" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" DataKeyNames="ID" ForeColor="Black">
<FooterStyle BackColor="#CCCCCC" />
<EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Street" HeaderText="Street" SortExpression="Street" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
<asp:BoundField DataField="Zip" HeaderText="Zip" SortExpression="Zip" />
<asp:BoundField DataField="Telephone Number" HeaderText="Telephone Number" SortExpression="Telephone Number" />
<asp:BoundField DataField="Contact Information" HeaderText="Contact Information"
SortExpression="Contact Information" />
<asp:BoundField DataField="E-mail address" HeaderText="E-mail address" SortExpression="E-mail address" />
<asp:BoundField DataField="Fax Number" HeaderText="Fax Number" SortExpression="Fax Number" />
<asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
</Fields>
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:DetailsView>
<br />
<br />
<br />
<asp:Button ID="Button2" runat="server" Text="E-Mail PO" Visible="False" OnClick="Button2_Click" />
</asp:Content>
whenever I run this, I receive the following error and am not sure how to correct it:
System.Data.SqlClient.SqlException: Must declare the scalar variable "@Item".
If someone could please explain to me the process here of what is going ion it would be greatly appreciated. My understanding is the @item is just a variable if you will so i'm not sure why its stating i need to declare it.
Thank you all!
View 4 Replies
View Related
Feb 17, 2008
Hi Guys,
I know this is a little off the subject of ASP.net but I am using some code behind in C#. I am a real novice at this and so it may appear to be a simple question but Im trying to add a number to the database from a textbox but it is having issues as the Storenum is an int and it wants a string. Can anyone help? I know I need to write .tostring somewhere but can't work out where. My code is below.
Thanks in advance. =)
public partial class _addstore : System.Web.UI.Page
{protected string Location;
protected string Telephone;protected string Prefix;
protected int StoreNum;protected string myConnectionString;protected void Page_Load(object sender, EventArgs e)
{
Location = "default";Telephone = "default";
Prefix = "default";StoreNum = "0";myConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\inetpub\wwwroot\HOF\App_Data\HOF.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;";
}protected void Button1_Click(object sender, EventArgs e)
{int sa;
SqlConnection myConnection = new SqlConnection(myConnectionString);
try
{
Location = TextBox2.Text;
Telephone = TextBox3.Text;
Prefix = TextBox4.Text;
StoreNum = TextBox5.Text;SqlCommand myCommand = new SqlCommand("INSERT INTO StoreInfo (StoreID, Location, Telephone, Prefix) Values (" + StoreNum + ", '" + Location + "', '" + Telephone + "', '" + Prefix + "')", myConnection);SqlDataAdapter myDataAdapter = new SqlDataAdapter(myCommand);
myConnection.Open();
sa = myCommand.ExecuteNonQuery();
myConnection.Close();
}catch (Exception ex)
{
TextBox2.Text = ex.Message;
myConnection.Close();
}
}
}
View 3 Replies
View Related
Apr 7, 2008
tell me how to add foreign keys in sql 2005 express
View 3 Replies
View Related
May 3, 2008
I am trying to create a sql database that will have a table with the following parameters. ID, Name, Picture. So i create the table and set the ID to an int the Name to an nvchar and the Picture to an image. My question is now how to i add a picture to this database. When i rightclick on the table and click show table data and attempt to add an image all i can type in is text. Thank you for your help
View 8 Replies
View Related
May 5, 2008
Hi,I have an application up and running. I need to add a new column to one of the tables which is currently being used - would adding a new column change or cause errors in the current application? e.g. if the table is being accessed by selecting * from table, will adding a new column cause an error? If there is any circumstance where an error would be caused by adding a new column, I will have to create an entirely new table. If I have to do this - how do I get a column in the new table to have the same values as a column in the old table? Can I create a computed column where column=oldcolumn? Thanks,Jon
View 5 Replies
View Related
May 11, 2004
When using the Xp_sendmail stored procedure from MS SQL 2000, I cannot use LF or CR of both otr VBnewLine in my messages.
For example
<code>
Trim(lblEmployee.Text) & " has requested a holiday. From " & CalendarPopupStartDate.SelectedDate & " till " & CalendarPopupStartDate.SelectedDate _
& "." & CARRIAGE RETURN WANTED &lblRequestedDays.Text & txtComments.Text
<code>
where you find the CARRIAGE RETURN WANTED, I want to begin a new line. My email is not formated asked :(
any help?
Greetz,
Geoff
View 5 Replies
View Related
Jul 28, 2004
I'm in trouble. I have a table with some fields, one of them is an amount of money.
One field indicates whether the amount is negetive or positive. This fields has only two possible values, 'N' and 'R'. 'N' means the amount is negative and 'R' means the amount is positive.
The problem I have is that I have to sum these amounts to give a total for each customer and report them as
customer1 total amount1
customer2 total amount2
I don't know how to make a query to bring these results. I know that sum would bring me the total amount for each customer but I don't know how to specify which fields are supposed to be negative so that it subtracts them instead of adding them.
By the way I'm not allowed to change the structure of the table.
Could you help me try to create this query?
View 2 Replies
View Related
Dec 22, 2004
I am trying to pull only records that are greater than 1 month prior to today's date. This is what I have so far....
select *
from MyTable
where eventDateStart > '$Now'
order by eventDateStart
$Now is a variable that pulls in today's date. This sql statement delivers only records that have a eventDateStart greater than today. My problem is I do not know how to make it so it only shows records that are 1 month prior.
Any idea how to do this?
View 4 Replies
View Related
Mar 13, 2005
Hi, I am so very new at using asp and my problem is that i have created a new access database and I am unable to connect to it. I am using the desktop engine and I can connect to all the sample database's fine. I've tried using the osql statments at the command prompt and after I am granted login and try to grant access to my new database called 'Assets' it tells me that i do not have access or permission to this database. If anyone can help me I would so so appreciate it (I need idiot instructions :) ).
View 2 Replies
View Related
Jul 8, 2005
HiHow do i simply add records to my Ms SQL database??Does anyone have an example?Best regards/Erik
View 1 Replies
View Related
May 25, 2001
Have small network of NT workstations, A PDC and BDC. We have one SQL database on the PDC and two others on the BDC. I added a new machine to the network, added users to that machine. When I try to add the new user, (Not Machine) to the database on the BDC, using security, add new user, I get the following message: Microsoft SQL-DMO ( ODBC SQL Statement 42000)
Error 15401: Windows NT user or group "domainnameusername" not found Check the name again.
The user 01 is listed on both the PDC and the BDC. I am totally baffled by this. Any help would be appreciated.
Stephen
View 1 Replies
View Related
Aug 30, 2001
Im using
ALTER TABLE mytable ADD PRIMARY KEY(mycolumn)
I want to use a specific name like PK_mycolumn, how the heck is this done?
thanks!
View 2 Replies
View Related