Scheduled Job Can't Insert Date
Aug 30, 2001
A user has created a scheduled job with the following command:
insert into tblHoursWorked ([DATE], STORE_ID, EMP_ID, HOURS, START_TIME, END_TIME)
values ('01-jan-2000', '4321', '9999999999', 5, '09:00', '14:00')
This can be run correctly from Query Analyser, but the job itself fails with the following error: Incorrect syntax near '20010830'. [SQLSTATE 42000] (Error 170). The step failed.
How do I get this to run as a sheduled task?? All the users and the server itself run under US English if it is relevant.
Thanks
Derek
View 2 Replies
ADVERTISEMENT
Dec 11, 2006
We have a product that uses SQL Express that is ready and waiting to go to market. It absolutely requires Vista compatibility on day one. When will SP2 be released? The UAC problem has been known for months.
We cannot distribute the November CTP, of course. Manually correcting SQL Express installs on Vista using the recommended workaround is impractical to say the least.
View 1 Replies
View Related
Feb 26, 2007
I have a job in SQL 2005 that when it runs works fine if I hard code the Makedate, what I need it to do is have the Makedate equal todays date minus one day...I came up with the code below, but that does seem to work...any thoughts.
INSERT INTO abcTransaction( Payee, Payment, AccountNumber)SELECT 'Credit', SUM(Rebate * Quantity), A.AccountNumberFROM Account AINNER JOIN abdTrades T on A.AccountNumber = T.AccountNumber Where MakeDate = getDate() - 1
GROUP BY A.AccountNumber
View 5 Replies
View Related
Nov 12, 2004
Hi there,
SQL newbie here, and thanks for any help you may able to provide.
My intention is to schedule/execute a stored procedure every morning at 12:00 a.m. that deletes all records with a column value of the day before. I.E., one of my Table columns is named POSTDAY, and could have values such as Sunday, Monday, Tuesday, etc, and on Tuesday morning, I'd like to DELETE all records with a POSTDAY value of Monday.
I think I can do this by creating and scheduling 7 different stored procedures (each with the actual DayName), but was wondering if it's possible to just have 1 accomplish the same thing, and without having to pass any parameters to it.
Thanks again.
View 4 Replies
View Related
Sep 26, 2007
Hello MSDN
I am using SQL 2005 and trying to INSTERT data in to a table
When I am using my command from SQL query windows it works fine,
INSERT INTO "tbl.FTPuploads" ("FTPFile_Names", "FTPGS", "FTPST", "FTPJOB", "FTPDN", "FTPSTATUS", "FTPDATE", "FTPTIME")
SELECT "FTPFile_Names", "FTPGS", "FTPST", "FTPJOB", "FTPDN", "FTPSTATUS", "FTPDATE", "FTPTIME"
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="G:DATAEDItoDB";Extended properties=Text')...uploaded#txt
But when I am trying to put that command in to a scheduled job I get this error
Executed as user: GWfmnlasa. Incorrect syntax near 'tbl.FTPuploads'. [SQLSTATE 42000] (Error 102). The step failed.
I have changed the command to this, I have removed the quotes from the table name.
INSERT INTO tbl.FTPuploads ("FTPFile_Names", "FTPGS", "FTPST", "FTPJOB", "FTPDN", "FTPSTATUS", "FTPDATE", "FTPTIME")
SELECT "FTPFile_Names", "FTPGS", "FTPST", "FTPJOB", "FTPDN", "FTPSTATUS", "FTPDATE", "FTPTIME"
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="G:DATAEDItoDB";Extended properties=Text')...uploaded#txt
And now I get this error
Executed as user: GWfmnlasa. Access to the remote server is denied because the current security context is not trusted. [SQLSTATE 42000] (Error 15274). The step failed.
View 4 Replies
View Related
Aug 24, 2015
PHP Code:
INSERT INTO [GPO].dbo.tblMetric  (KPI_ID, METRIC_ID, GOAL, REPORTING_MONTH, ACTUALS)Â
SELECTÂ
   Â
      1 AS KPI_OWNER_ID
    , 23 AS METRIC_IDÂ
    , .75 AS GOALÂ
    , CAST(Z.REPORTING_MONTH as DATE) AS REPORTING_MONTH
    , SUM(CAST(FTP_COUNT AS DECIMAL))/SUM(CAST(FULL_COUNT AS DECIMAL)) AS ACTUALS
[Code] ....
The insert column I am trying to get into is a date type. The original state of the field is YYYYMM varchar. How to get this into the table.
View 3 Replies
View Related
Jan 14, 2008
need help
help me -CURSOR backward insert from End Date > to Start Date
how to insert dates from end to start
like this
SELECT 111111,1,CONVERT(DATETIME, '17/03/2008', 103), CONVERT(DATETIME, '01/03/2008'
i explain i have stord prosege that create mod cycle shift pattern
and it working ok
now i need to overturned the insert so the first insert is the '17/03/2008' to '16/03/2008' ..15...14..13..12...2...1
so the first insert be '17/03/2008' next '16/03/2008' ...........................01/03/2008
tnx
Code Block
DECLARE
@shifts_pattern TABLE ([PatternId] [int] IDENTITY(1,1 ) NOT NULL, [patternShiftValue] [int]NOT NULL)
declare
@I int
set
@i=0
while
@i < 5
BEGIN
INSERT INTO @shifts_pattern ([patternShiftValue] )
SELECT 1 UNION ALL
SELECT 2 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 5 UNION ALL
SELECT 6 UNION ALL
SELECT 7 UNION ALL
SELECT 8
set
@i=@i+1
end
declare
@empList
TABLE
( [empID] [numeric](18, 0) NOT NULL,[ShiftType] [int]NULL,[StartDate][datetime]NOT NULL,[EndDate] [datetime] NOT NULL)
INSERT INTO
@empList ([empID], [ShiftType],[StartDate],[EndDate])
SELECT 111111,1,CONVERT(DATETIME, '01/01/2008', 103), CONVERT(DATETIME, '17/01/2008', 103)
-- create shifts table
declare
@empShifts
TABLE ( [empID] [numeric](18, 0) NOT NULL,[ShiftDate] [datetime]NOT NULL,[ShiftType] [int]NULL ,[StartDate] [datetime]NOT NULL,[EndDate] [datetime]NOT NULL)
DECLARE
@StartDate datetime
DECLARE
@EndDate datetime
Declare
@current datetime
DEclare
@last_shift_id int
Declare
@input_empID int
----------------- open list table for emp with curser
DECLARE
List_of_emp CURSOR FOR
SELECT
emp.empId,emp.ShiftType,emp.StartDate,emp.EndDate FROM @empList emp
OPEN
List_of_emp
FETCH
List_of_emp INTO @input_empID , @last_shift_id ,@StartDate,@EndDate
SET @current = @StartDate
-----------------
-- loop on all emp in the list
while
@@Fetch_Status = 0
begin
-- loop to insert info of emp shifts
while
@current<=@EndDate
begin
INSERT INTO @empShifts ([empID],[ShiftDate],[ShiftType],[StartDate] ,[EndDate])
select @input_empID ,@current,shift .patternShiftValue ,@StartDate,@EndDate
from @shifts_pattern as shift where PatternId=@last_shift_id+1
-- if it is Friday and we are on one of the first shift we don't move to next shift type .
if (DATENAME(dw ,@current) = 'Friday' ) and
EXISTS(select ShiftType from @empShifts where ShiftDate=@current and empID= @input_empID and ShiftType in ( 1,2,3))
-- do nothing
--set @last_shift_id=@last_shift_id
print ('friday first shift')
ELSE
set @last_shift_id=@last_shift_id+ 1
set @current=DATEADD( d,1, @current)
end
FETCH
List_of_emp INTO @input_empID ,@last_shift_id,@StartDate,@EndDate
-- init of start date for the next emp
set
@current = @StartDate
end
CLOSE
List_of_emp
DEALLOCATE
List_of_emp
select
empID,shiftDate,DATENAME (dw,shift.ShiftDate ), shiftType from @empShifts as shift
RETURN
View 4 Replies
View Related
Feb 26, 2008
Hi,
I need to insert into a column (lets say column x) a date based on the date on another column (lets say column y).
What I need is:
Take the day and month from column x (all records are formated yyyy-mm-dd)
Place it in column y
The yyyy in column y should be - currenct year +1 and no the year in column x.
All help welcome.
View 9 Replies
View Related
Jun 28, 2007
Help please!
I have an asp page with some simple vbscript to add a record to a table, the record has a datefield (dob).
the insert results in a US formated date if I add a record to a dynamic recordset but a UK formated date if I insert direct to the table ?????
i.e.
if request("dob") is "01/11/2007" (1st november 2007)
set conn = server.createobject("adodb.connection")
set rs = server.createobject("adodb.recordset")
rs.open "tez", mc, 2, 2 rs.addnew
rs("dob") = request("dob")
rs.update
11 jan 2007 stored in table
while
set trs = Server.CreateObject("ADODB.RecordSet")
qfn= "insert tez values('"+request("dob")+"')"
trs.Open qfn,mc
results in
1 november 2007 is written to the table.
Both of these methods are used in the same asp page.
This is on a windows2003 server, sql2005,iisv6, asp.netv2
I have tried every setting I can find in iis,asp,sql server to no avail.
I need the recordset method to work correctly.
Terry
View 8 Replies
View Related
Oct 11, 2007
I'm a beginner to SQL Server 2005. I'm building a small form with a SQL2005 database. I'm creating the database and adding a field called DateInsert. When the user clicks the submit button and the form data gets written to my database, how do I automatically generate a timestamp and write it to my DateInsert Field in the database? Thanks in advance!
View 5 Replies
View Related
Nov 13, 2007
I have a table which gets filled when Electronic data comes in. I want to add a column which will show a date when that row gets inserted into the table. In any case, I don't want to modify the program which is ruuning to fill the table.
Is there a way to call getdate() when a new row is inserted ? OR any other solution ?
Please Help........
View 11 Replies
View Related
Jan 28, 2005
I am attempting to insert a new row into an SQL database using
VB.NET one of the SQL feild is DATE and its dataTYPE is smalldatetime
dim datenow as string
datenow = format(now(),"dd/MM/yyyy")
but this gave me an error
INSERT INTO desc_sec(Course_code, DATE) VALUES('" & txtCourse.Text & "', '" & datenow & "' ) i used '" & txtCourse.Text & "' for inserting string what about inserting date
i should Wrap datenow values inside # for quoting instead of ' but how ?????
View 2 Replies
View Related
Jul 27, 2005
Hello,
In a stored procedure;
INSERT INTO myTable(myDate) VALUES (@myDate)
This inserts data and time, is there any way I can only insert date portion of DateTime
Thanks,
View 2 Replies
View Related
Dec 17, 2001
I just wonder how i can do this without insering the date manually?
Here is the sqlcmd i run it´s the last one i need help on.
insert into datum (datum) value ('2001-12-17')
Please help!
Regard
/Fredrik
View 3 Replies
View Related
Mar 3, 2000
Hello,
I am trying to insert a date in the date field define
as datetime eg.
create table test2
(date datetime,
id integer)
insert test2
values
(02-05-2000,123)
or say
insert test2
values
('02-05-1999',123)
then when I do select * the dates shown are always default.
what is the correct form of inserting date into datetime field and
not letting it to system default. I know it seems pretty simple, I
must be overlooking some thing very simple. Any help appreciated.
Thank you
View 2 Replies
View Related
Aug 19, 2013
I am using MSSQL 2005. I have a table with the columns StopTime and StartTime. I run a query that shows the time different between StopTime and StartTime grouped by day. If the StartTime is the next day, it throws off my query. I can run a SSIS package or trigger, what ever works, I just don't know how to do it. Lets say the table looks like this (notice StartTime is the next day):
RowNumber AssetID StopTime StartTime
01 01 8/10/2013 9:00:00 PM 8/11/2013 9:00:00 PM
If that happens I want this to happen:
RowNumber AssetID StopTime StartTime
01 01 8/10/2013 9:00:00 PM 8/11/2013 11:59:59 PM
02 01 8/11/2013 12:00:00 AM 8/11/2013 9:00:00 PM
This way, all my datediff calculations are grouped by the right day.
Also, could it work to span multilpe days, with a new row for every day between StopTime and StartTime?
View 3 Replies
View Related
Mar 28, 2007
Hi
I don't know if this is the right forum
but i have a soloution where i use a sqlstring to insert a date
in a sql table, before we use Access but know i can't get it to work
i have this:
cmd.CommandText = "INSERT Into undereval (visitation, hardware , software, materiale, lokale, frokost, bem, kategori , beskrivelse, underviser, startdato, slutdato ) VALUES ('" & txtvisitation.Text & "','" & txthard.Text & "','" & txtsoft.Text & "','" & txtunder.Text & "','" & txtlokale.Text & "' ,'" & txtpauser.Text & "','" & txtbem.Text & "', '" & kat & "', '" & kursus & " ', " & hovedmenu.underviser & ", " & Label8.Text & ", " & Label10.Text & ")
Startdato, slutdato are Date fields in the sql
and the value i have comes from Label8.text - label10.text
Hope someone can help
Alvin
View 4 Replies
View Related
Jun 16, 2007
i want to save date using inert query like insert into tablname(field1,f2) values('jan',"& format(system.date.now,"dd/MM/yyyy hh:mm ") so to give error that char will not be converted to date and time.plz help its urgent.the same problem is with select query toooooo.
View 7 Replies
View Related
Nov 25, 2007
Hi , I am trying to insert date in my SQL database. Functionality I am looking for is when user will click the button current date & time should be inserted in database automatically following is the code I am using <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:NorthwindConnectionString %>" insertcommand="INSERT INTO [TryNow] ([Name], , [organization] ) VALUES (@CompanyName, @Phone, @Org)" selectcommand="SELECT * FROM [TryNow]"> <insertparameters> <%--<asp:ControlParameter Controlid="txtDate" Name="DateCreated" />--%> <asp:controlparameter controlid="txtName" name="CompanyName" /> <asp:controlparameter controlid="txtEmail" name="Phone" /> <asp:controlparameter controlid="txtOrg" name="Org" /> <asp:Parameter Name="DateCreated" /> </insertparameters> </asp:sqldatasource>
Code Behind : protected void btnSubmit_Click(object sender, EventArgs e) { SqlDataSource1.Insert(); }protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["@DateCreated"].Value = DateTime.Now; } Can you please suggest where I am going wrong ?
Thank You,
Regards,
-Sunny.
View 5 Replies
View Related
Dec 3, 2007
Hi guys,how do i insert the current date in SQL?
View 2 Replies
View Related
Mar 4, 2008
This is a simple n00b question, but how can I insert the current date time into a datetime field in a database when submitting a form?
I'm using the SQL DataSource control to do the inserting: <asp:SqlDataSource ID="SqlDataSourceMiguel" runat="server" ConnectionString="<%$ ConnectionStrings:SQLDataConnectionToInsertMiguelsTips %>"
InsertCommand="INSERT INTO tblMig(TipTitle, TipBody, TipExcerpt,TipDate) VALUES (@Title,@Body,@Excerpt,@varDate)">
<InsertParameters><asp:ControlParameter ControlID="ctl00$ContentPlaceHolder3$txtTitle" Name="Title" PropertyName="Text" /><asp:ControlParameter ControlID="ctl00$ContentPlaceHolder3$txtBody" Name="Body" PropertyName="Text" /><asp:ControlParameter ControlID="ctl00$ContentPlaceHolder3$txtExcerpt" Name="Excerpt" PropertyName="Text" /><asp:ControlParameter ControlID="ctl00$ContentPlaceHolder3$txtDateNow" Name="varDate" /></InsertParameters></asp:SqlDataSource>
Thank You
View 4 Replies
View Related
Mar 13, 2004
I am trying to insert the current date into my database here is the code I am using
sql = "Insert into tblguestbook(date, name, city, state, email, Url, Comments)Values ('"
sql = sql & Request.Form(Now) & "','"
sql = sql & Request.Form("nametxt") & "','"
sql = sql & Request.Form("citytxt") & "','"
sql = sql & Request.Form("statetxt") & "','"
sql = sql & Request.Form("emailtxt") & "','"
sql = sql & Request.Form("urltxt") & "','"
sql = sql & Request.Form("commentstxt") & "');"
When I review my table the only date that will go into it is 1/1/1900.
Please help
View 6 Replies
View Related
Feb 11, 2006
hi...
my form has a text box which displays system date.
i am inserting date into MS SQL Server from this date textbox.
but it displays me error..
String was not recognized as a valid DateTime.
Line 154: myCommand1.ExecuteNonQuery()
i have written code as
myCommand1.Parameters.Add(New SqlParameter("@date", SqlDbType.DateTime, 8))
myCommand1.Parameters("@date").Value = FormatDateTime(datetxt.Text, DateFormat.GeneralDate)
and also tried to change date format with many other ways.
how should i solve this problem?
i also want to take time form a user with the help of web form and want to store it in other field called 'timein' and 'timeout'.....
View 5 Replies
View Related
Dec 7, 2004
Hi all,
I have an application that receive date input from user in the dd/mm/yyyy format. When I tried to insert the record into the SQL Server with an INSERT statement, I received an error message indicating the date index is out of range. I guess, the SQL Server is expecting the date format to be mm/dd/yyyy. Is there any way that I can input the date into SQL Server in dd/mm/yyyy format.
Thank You
hawwa
View 6 Replies
View Related
Oct 4, 2007
HI i just want to know how to insert data in SQL SERVER CE date field .
I want select query also.
thanx in advance
View 1 Replies
View Related
Sep 7, 2006
Hey there,
I'm trying to add rows to a table and pass a date value through. I use Format(Date.now, "dd MMM yyyy") however when I check in SQL Server Managment Studio it has swapped the day and month round (e.g. input of "7/9/2006" will be "9/7/2006" on the actual table. Actually the output is 2006-07-09 00:00:00:00.) I've put the full source code below.
Can anyone help with this?
Cheers,
Danny
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Dim dtdate As Date
Dim cn As New SqlConnection("server=*********;database=********;USER ID=*********;password=*********")
Dim objCommand As New SqlCommand("", cn)
Dim ws As New wrtRefID.Service
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dtdate = Now
AddHistory("ActivityID", 1, "AccountID", "AccountName", "ContactName", "Category", Microsoft.VisualBasic.Format(dtdate, "dd MMM yyyy"), 2, "Description", "UserName", Microsoft.VisualBasic.Format(dtdate, "dd MMM yyyy"), "CreateUser", "Notes", "LongNotes")
MessageBox.Show("DONE")
End Sub
Private Sub AddHistory(ByVal ActivityID As String, ByVal Type As Integer, ByVal AccountID As String, _
ByVal AccountName As String, ByVal ContactName As String, ByVal Category As String, ByVal StartDate As Date, _
ByVal Duration As Integer, ByVal Description As String, ByVal UserName As String, _
ByVal CreateDate As Date, ByVal CreateUser As String, ByVal Notes As String, ByVal LongNotes As String)
cn.Open()
objCommand.CommandText = "INSERT INTO HISTORY (HISTORYID, ACTIVITYID, Type, ACCOUNTID, ACCOUNTNAME, CONTACTNAME, " & _
"CATEGORY, STARTDATE, DURATION, DESCRIPTION, USERNAME, CREATEDATE, CREATEUSER, NOTES, LONGNOTES) " & _
"VALUES ('" & ws.MCS2_SLXID("HISTORY") & "', " & "'" & ActivityID & "', '" & Type & "', '" & AccountID & "', '" & AccountName & "', '" & ContactName & _
"', '" & Category & "', '" & StartDate & "', '" & Duration & "', '" & Description & "', '" & UserName & _
"', '" & CreateDate & "', '" & CreateUser & "', '" & Notes & "', '" & LongNotes & "')"
' MessageBox.Show(Format(dtdate, "dd MMM yyyy"))
TextBox1.Text = objCommand.CommandText
objCommand.ExecuteNonQuery()
cn.Close()
End Sub
End Class
View 3 Replies
View Related
Sep 7, 2006
Hey there,
I'm trying to add rows to a table and pass a date value through. I use Format(Date.now, "dd MMM yyyy") however when I check in SQL Server Managment Studio it has swapped the day and month round (e.g. input of "7/9/2006" will be "9/7/2006" on the actual table. Actually the output is 2006-07-09 00:00:00:00.) I've put the full source code below.
Can anyone help with this?
Cheers,
Danny
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Dim dtdate As Date
Dim cn As New SqlConnection("server=*********;database=********;USER ID=*********;password=*********")
Dim objCommand As New SqlCommand("", cn)
Dim ws As New wrtRefID.Service
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dtdate = Now
AddHistory("ActivityID", 1, "AccountID", "AccountName", "ContactName", "Category", Microsoft.VisualBasic.Format(dtdate, "dd MMM yyyy"), 2, "Description", "UserName", Microsoft.VisualBasic.Format(dtdate, "dd MMM yyyy"), "CreateUser", "Notes", "LongNotes")
MessageBox.Show("DONE")
End Sub
Private Sub AddHistory(ByVal ActivityID As String, ByVal Type As Integer, ByVal AccountID As String, _
ByVal AccountName As String, ByVal ContactName As String, ByVal Category As String, ByVal StartDate As Date, _
ByVal Duration As Integer, ByVal Description As String, ByVal UserName As String, _
ByVal CreateDate As Date, ByVal CreateUser As String, ByVal Notes As String, ByVal LongNotes As String)
cn.Open()
objCommand.CommandText = "INSERT INTO HISTORY (HISTORYID, ACTIVITYID, Type, ACCOUNTID, ACCOUNTNAME, CONTACTNAME, " & _
"CATEGORY, STARTDATE, DURATION, DESCRIPTION, USERNAME, CREATEDATE, CREATEUSER, NOTES, LONGNOTES) " & _
"VALUES ('" & ws.MCS2_SLXID("HISTORY") & "', " & "'" & ActivityID & "', '" & Type & "', '" & AccountID & "', '" & AccountName & "', '" & ContactName & _
"', '" & Category & "', '" & StartDate & "', '" & Duration & "', '" & Description & "', '" & UserName & _
"', '" & CreateDate & "', '" & CreateUser & "', '" & Notes & "', '" & LongNotes & "')"
' MessageBox.Show(Format(dtdate, "dd MMM yyyy"))
TextBox1.Text = objCommand.CommandText
objCommand.ExecuteNonQuery()
cn.Close()
End Sub
End Class
View 4 Replies
View Related
Sep 10, 2006
HiLets say I have a user registration table and I want to know since when the member joined the club.How do I make the insert clause to include the date or date+time ?TIAGuy
View 24 Replies
View Related
Apr 4, 2007
Hi. I am sitting here as a newbie programming my first web application.I have in my tables a column ‘Birthday’ declared as a smalldatetime (I only want to store year, month and day).Where Year, Month ans Days are dropdownlist.
Inserting the data I use this code:
Dim Birthday As New DateTime(Int32.Parse(Year.SelectedValue), Int32.Parse(Month.SelectedValue), Int32.Parse(Days.SelectedValue))-and then I use Birthday in my stored procedures.
Whan I look into my tabel is ses the value is stored like this: 12.01.1996 00:00:00
This is also the result if I change the column declaration from smalldatetime to DateTime.Is 12.01.1996 00:00:00 (mm.dd.yyyy) the correct value in my DB. I whould have expecetd dd.mm.yyyy or yyyy.mm.dd ?
Please avise.
View 4 Replies
View Related
May 1, 2007
how i make date field in database auto updated,some one told me to use '" Now "' in insert command, but it dos't work, i think it's for asp. regards
View 4 Replies
View Related
Dec 11, 2007
hi all!I have a task, for example, to create a record for bill. I have table which represents this bill entity (Bill_ID, Amount, CreationDate, ExposureDate, PaymentDate)In table definition date fields allow null. I would like to create bill, which means insert record: (new_bill_id, 1000, 2007.12.11, null, null) But it couses exception. Smth like: System.Data.SqlTypes.SqlTypeException, date should be not null. How could I do it?Please advice!
View 5 Replies
View Related
Dec 17, 2003
How to insert date into database SQL 2000 that the date read from server ?
View 5 Replies
View Related
Apr 16, 2006
Hi,
The following INSERT query works in all aspects apart from the date value:
String InsertCmd = string.Format("INSERT INTO [CommPayments] ([CommPaymentID], [Date], [InvestmentID], [Amount]) VALUES ({0},{1},{2},{3})", FormView1.SelectedValue, txtPaymentDate.Text, ddlInvestments.SelectedValue, txtAmount.Text);
The value of txtPaymentDate.Text is "13/04/2006" but is inserted as a zero value (i.e. "01/01/1900").
In additon to replacing {1} with a string, I've tried changing {1} to both '{1}' and #{1}#, both of which are "caught" by my try/catch on the INSERT.
What am I doing wrong? Thanks very much.
Regards
Gary
View 3 Replies
View Related