SQL Error 'INITCOLVS' Is Not A Recognized Built-in Function Name.

Jan 30, 2007

Hello All,

Can anyone tell me what is  error is and how to resolve it?

Thanks.

View 4 Replies


ADVERTISEMENT

'INITCOLVS' Is Not A Recognized Built-in Function Name.

Nov 27, 2007

I have read all of the messages related to the above problem and none have solved the issue.
We have migrated a SQL 2000 database to SQL 2005.  Detached from one and attached to the other and then based on some of the conversation I also used the SQL Server 2005's copy option and copied the database.  Detached the old one and renamed the new database which was created in the copy process to the old name.  Basically getting back to where I started.  By the way there are no triggers generated during the process (as was mentioned), nothing to delete as some of the discussion was suggesting.  
Big databse, lots of tables and stored procedures.  All screens seem to work except when we try to update some data using a stored procedure which takes the data and updates the table.  End up getting the above error during the execution.  All used to work fine with SQL Server 2000.  I have taken the SQL out of the stored procedure and executed manually and it worked but leaving the stored procedure alone and calling it with the updated data we get the INITCOLVS problem.  The database is also set to be compatible to 90 so that suggestion also has not fixed the problem.  Looking for additional suggestions and solutions.  Some one was talking about making a dummy INITCOLVS function, have not done this yet but don't particularly like this suggestion, like to know the cause and the proper solution to the problem.
Again in summary:
Migrated SQL 2000 database to 2005
Have done the copy and attach process to make sure the whole conversion to SQL Server 2005 has taken place.
Have set the compatibility of the database to 90
Updates cause the above error. 
 
 Thanks in advance.
 Don 
 

View 1 Replies View Related

Date Is Not A Recognized Built-in Function Name

Mar 21, 2013

how to format the last part of this query which comes from Access.:

SELECT Max(TITLOC.TitleLocID) AS MaxOfTitleLocID, TITLES.TitleID, TITLES.CustLName, TITLES.CustFName, TITLES.RecDT, TITLES.TitleID
FROM (TITLES_WARNING_SENT_qry RIGHT JOIN TITLES ON TITLES_WARNING_SENT_qry.TitleID = TITLES.TitleID) INNER JOIN TITLOC ON TITLES.TitleID = TITLOC.TitleID
WHERE TITLES_WARNING_SENT_qry.TitleID Is Null
GROUP BY TITLES.CustLName, TITLES.CustFName, TITLES.RecDT, TITLES.TitleID, TITLES.TitleID
HAVING (TITLES.RecDT<Date()-31)

I am getting:
'Date' is not a recognized built-in function name.

It is probably something simple but how would I go about converting this part "HAVING (TITLES.RecDT<Date()-31)" to something SQL Server is happy with?

View 4 Replies View Related

SQL 2012 :: AVG Is Not A Recognized Built-in Function Name

Nov 10, 2014

I am trying to pull a report with average down time and I getting the error message "Msg 195, Level 15, State 10, Line 4 'AVG' is not a recognized built-in function name." when I try to run the below query. How can I rephrase the AVG(DateDiff) line to calculate this for me?

SELECT
TT.PartNumber
,AVG (TT.TimeToRepair) as [Avg Time to Repair (Hours)]
,AVG(DateDiff (hour,TT.TimeDateReported,TT.DateClosed) as [Turnaround Time(Hours)])
FROM dbo.vt_TroubleTicket TT
WHERE TT.Closed = '-1'
and TT.DateClosed between '1/1/2013' and '1/1/2014'
and (TT.PartNumber = '12345')
GROUP BY TT.PartNumber

View 3 Replies View Related

OBJECT_SCHEMA_NAME Is Not A Recognized Built-in Function Name

Jan 28, 2008

why I am getting this error on the SQl Server 2005 but not getting it on the SQL Server Express? and how to ifx?





Code Snippet

Msg 195, Level 15, State 10, Procedure sp_check_sp, Line 14
'OBJECT_SCHEMA_NAME' is not a recognized built-in function name.


this is my code:





Code Snippet

USE shefa
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_check_sp]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

SELECT DB_NAME(st.dbid) DBName
, OBJECT_SCHEMA_NAME(st.objectid, dbid) SchemaName
, OBJECT_NAME(st.objectid, dbid) StoredProcedure
, MAX(cp.usecounts) Execution_count
FROM sys.dm_exec_cached_plans cp
CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st
WHERE DB_NAME(st.dbid) IS NOT NULL AND cp.objtype = 'proc'
GROUP BY cp.plan_handle, DB_NAME(st.dbid),
OBJECT_SCHEMA_NAME(objectid, st.dbid),
OBJECT_NAME(objectid, st.dbid)
ORDER BY MAX(cp.usecounts)
END

View 4 Replies View Related

ROW_NUMBER() Function Is Not Recognized In Store Procedure.(how To Add ROW_NUMBER() Function Into SQL SERVER 2005 DataBase Library )

Feb 4, 2008

Can anybody know ,how can we add  builtin functions(ROW_NUMBER()) of Sql Server 2005  into database library.
I get this error when i used into storeprocedure :
ROW_NUMBER() function is not recognized in store procedure.
i used MS SQL SERVER 2005 , so i think "ROW_FUNCTION()" is not in MS SQL SERVER 2005 database library.
I need to add that function into MS SQL SERVER 2005 database library.
Can anbody know how we can add that function into MS SQL SERVER 2005 database library?
 

View 4 Replies View Related

'min' Is Not A Recognized Function Name

Oct 8, 2004

I am using MS SQL Server 2000. I am reading right off of microsofts web site under Trasact-SQL Reference, on how to use the MIN function. Yet when I try to use it, I get the error:

'min' is not a recognized function name

Here is the sql statement copied right out of Query Analyzer:

select name, count(name), min(
case when not(var6 = '') then 7 else
case when not(var5 ='') then 6 else
case when not(var4 ='') then 5 else
case when not(var3 ='') then 4 else
case when not(var2 ='') then 3 else
case when not(var1 ='') then 2 else 1 end end end end end end as cols
)
from syitabs
where dupef=0
group by name

View 2 Replies View Related

Help!!!!built In Function In Sql

Aug 15, 2007

Hi,
Is there some kind of built in function in SQl to look for the presence of certain characters in a table collumn.I have to replace the text in those collumns with different text or just use substr, instr functions.
Thanks in advance

View 4 Replies View Related

'EncryptByPassPhrase' Is Not A Recognized Function Name.

Mar 2, 2006

I am trying to run the following code in SQL Server 2005:

DECLARE @cleartext NVARCHAR(100)

DECLARE @encryptedstuff NVARCHAR(100)

DECLARE @decryptedstuff NVARCHAR(100)

SET @cleartext = 'XYZ'

SET @encryptedstuff = EncryptByPassPhrase('12345', @cleartext)

SELECT @encryptedstuff

SET @decryptedstuff = DecryptByPassphrase('12345', @encryptedstuff)

SELECT @decryptedstuff



and am recieving an error:

Msg 195, Level 15, State 10, Line 5

'EncryptByPassPhrase' is not a recognized function name.

Msg 195, Level 15, State 10, Line 7

'DecryptByPassphrase' is not a recognized function name.



It appears as though this EncryptByPassPhrase and DecryptByPassphrase as supported in 2005 T-SQL commands but when I execute this code in SQL Server Studio it errors out.

Anyone know why?

View 1 Replies View Related

SQL2K5 SP2 - 'ROW_NUMBER' Is Not A Recognized Function Name

Aug 15, 2007

The row_number functions doesn't seem to be operable in our version of SQL Server 2005 SP2.

We have completely tried everything, including using the sample database, and Query posted in the 2005 SQL Server 2005 Book, which is as follows:


SELECT empid, qty,

ROW_NUMBER() OVER(ORDER BY qty) AS rownum

FROM dbo.Sales

ORDER BY qty;


I get the following error:


Msg 195, Level 15, State 10, Line 2

'ROW_NUMBER' is not a recognized function name.

Below you will find the versions of SQL we are using of 2005.


Microsoft SQL Server Management Studio 9.00.3042.00
Microsoft Analysis Services Client Tools 2005.090.3042.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 7.0.5730.11
Microsoft .NET Framework 2.0.50727.42
Operating System 5.1.2600

Please help!! Thanks in Advance,

Jason

View 4 Replies View Related

ROW_NUMBER() Function Is Not Recognized In Store Procedure.

Dec 24, 2007

Hello I am Prasad , I have written one store procedure as below. But It gives error message ROW_NUMBER() function is not recognized. what's the fault or what should i change.
CREATE PROCEDURE GetProductsOnCatalogPromotion(@DescriptionLength INT,@PageNumber INT,@ProductsPerPage INT,@HowManyProducts INT OUTPUT)AS-- declare a new TABLE variableDECLARE @Products TABLE(RowNumber INT,ProductID INT,Name VARCHAR(50),Description VARCHAR(5000),Price MONEY,Image1FileName VARCHAR(50),Image2FileName VARCHAR(50),OnDepartmentPromotion bit,OnCatalogPromotion bit)-- populate the table variable with the complete list of productsINSERT INTO @ProductsSELECT ROW_NUMBER() OVER (ORDER BY Product.ProductID),ProductID, Name,SUBSTRING(Description, 1, @DescriptionLength) + '...' AS Description, Price,Image1FileName, Image2FileName, OnDepartmentPromotion, OnCatalogPromotionFROM ProductWHERE OnCatalogPromotion = 1-- return the total number of products using an OUTPUT variableSELECT @HowManyProducts = COUNT(ProductID) FROM @Products-- extract the requested page of productsSELECT ProductID, Name, Description, Price, Image1FileName,Image2FileName, OnDepartmentPromotion, OnCatalogPromotionFROM @ProductsWHERE RowNumber > (@PageNumber - 1) * @ProductsPerPageAND RowNumber <= @PageNumber * @ProductsPerPage

View 4 Replies View Related

FREETEXT And CONTAINS Keywords Generate `not A Recognized Function Name`

Sep 14, 1998

I installed SQL server 7.0 beta 3 and I have been experimenting with the full text search capabilities. The catalogs appear to build correctly, but when I issue a query against the full text database, isql/w always returns with `contains` is not a recognized function name. I am confident of my query syntax, since I can execute an identical query against a database without full text search enabled and I get an error stating that the target database does not have full text searching enabled. Has anybody else encountered this? I am hoping that I am missing something obvious/simple.

View 2 Replies View Related

SQL Server 2012 :: Getting A Variable Recognized In A Function

Apr 4, 2014

I am having a hard time getting a variable recognized in a function. The variable is not being seen properly in the charindex function.

@ExtType contains = X
@PhoneNo contains = +1 (202) 123-9876 X012

select @intPos = charindex(@ExtType,Upper(@PhoneNo))

View 1 Replies View Related

The Function Is Not Recognized By SQl Server Compact Edition

Sep 8, 2007



Unfortunatly this appers when i am trying to execute the following Query :


SELECT CurrentDate AS EXPR2
FROM [Date]
WHERE (DAy(CurrentDate) = 2)

It seems it doesn't support the (Day) function...Is there any solution or work around for that ?

View 1 Replies View Related

Any Built-in Function To Show Table Relationship?

Feb 5, 2007

Hi guys

I have a table which I need to analyze, what jobs this is working with, what stored procedure is calling this table etc. Is there any built-in function to show me or anybody know how to do it? This is my new job, and there are hundreds of stored procedures and jobs, do i really have to go thru one by one?

Please help.

Michelle

View 3 Replies View Related

Built In Function To Search The Occurence Of Char In String

Jan 10, 2008



Hi Everyone-
i woder if someone know Built in function to search the occurence of char in string in T-SQL

and iam not talking about the Index of the first occurence (e.g CHARINDEX )
but it is more generic

i want to send to the function to ask about the index the second or the third or N occurence of the char.
and i wonder if it is built in for performance reasons

example
getseachIndex("M|d|d","|",2)==> the result is 4

View 3 Replies View Related

&"MAXRECURSION&" Keyword Not Recognized Within Function?

Mar 20, 2007

Koroner writes "Hi all. I'm very new to SQL programming so when I started coding I already expected some problem like the one I now describe to present itself soon.
I'm not an English native speaker, pardon me for making any mistake.

I'm currently programming in ASP.NET using Visual Studio.

I've defined a function which consists of one quite simple query calling itself in a recursive way. The problem occurrs when running a view to check whether the function works prorperly, since the "nesting limit exceeded" error (not exact words) pops up.
I didn't know there was such a limit.

Searching the Web I've learnt there is a way to modify this limit, that is using the OPTION clause and the MAXRECURSION hint.

But the fact is whenever I add the OPTION clause to the SELECT of my function Visual Studio tells me that there is a syntax error near "OPTION" keyword. I'm sure VS is not recognizing the "MAXRECURSION" keyword, because there are no syntax errors and the word is not colored in blue (unlike other keywords).

What puzzles me most is that I tried to define a recursive SELECT provided with OPTION clause within a view or an on-the-fly query and all works fine there.

Thanks for any reply."

View 7 Replies View Related

Error:the String Was Not Recognized As A Valid DateTime.

Aug 31, 2007

hi all, i'm trying to insert the time/date a button was clicked on a gridview and it generates an error:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0 i have changed the culture to en-US but it still doesn't work. i actually created the date/time column after some data had been entered into the table so the column allows nulls. this is my code:InsertCommand="INSERT INTO test101(Surname,Names,Registration,Login Time)VALUES (@Surname, @Names, @Registration,@Login_Time)"<Insert Parameters><asp:Parameter DefaultValue= DateTime.Now Type=DateTime Name="Login_Time" /></Insert Parameters>any suggestions?

View 9 Replies View Related

Error - (exec) Is Not Recognized As Internal Or External Command

May 16, 2013

I am trying to execute a stored proc like this

Declare @cmd varchar(1000)
Declare @Path1 varchar (1000)
Declare @user_id varchar (50)
Declare @password varchar (50)
set @cmd = 'exec' + ' ' + stored_proc_name' + ', ' + @user_id +', ' + @password + ', ' + @Path1
exec master..xp_cmdshell @cmd

ERROR I am getting = 'exec' is not recognized as an internal or external command,

View 2 Replies View Related

Error When Training Mining Model. Column Name Seems Can't Be Recognized

Jul 11, 2007



Dear All, I have a simple mining structure created by the DMX statement below. Then I tried to insert some data with MDX language by extracting data in OLAP. But I got the following error when I execute the insert statement.



Errors in the high-level relational engine. The 'Customer ID' column in the RELATES clause was not found in the results of the OPENROWSET query.


It seems that the append statement can't really recognize the name of the column which should be Customer ID.



How can I fix this problem?



Thanks

Tony Chun Tung Siu



The source code for create and insert is as below.



create mining model customerMiner
(
customerID long key ,
age long continuous,
orders table
(
orderID long key,
goodsID long discrete predict_only
)
)using [Microsoft_decision_trees] with drillthrough;

insert into mining model customerMiner
(
customerID,
age,
orders
(
skip,
orderID,
goodsID
)
)
shape
{
openQuery([Simple SSAS],
'
select {[Measures].[Customer ID], [Measures].[Age]} on columns,
{[Customer].[Customer].[Customer].members} on rows
from fi
')
}
append
(
{
openQuery([Simple SSAS],
'
select {[Measures].[Customer ID],[Measures].[Order ID2],[Measures].[Goods ID]} on columns,
[Goods].[Order ID2].[Order ID2].members on rows
from fi
')
}
relate [Customer ID] to [Customer ID]
)as orders

View 1 Replies View Related

Dynamic Built Where Clause - Error In Stored Procedure

Mar 2, 2005

I'm sending a stored procedure a number of parameters, including an int for a foreign key field. I'm trying to dynamically build the Where Clause of the query.

I'm getting the error:

Syntax error converting the varchar value 'wo_dutfk = ' to a column of data type int.

NOTE: wo_dutfk is an int field within the WO table.

Here's the code:

CREATE PROCEDURE dbo.ewo_sp_WOLookup
(
@WODUTFK int=NULL,
@WOENDDATE datetime = NULL,
@WOSTATUS char(10) = NULL,
@DEBUG int=0
)

AS

Declare @intErrorCode int,
@chvQuery varchar (8000),
@chvWhere varchar (8000)

select @intErrorCode = @@ERROR,
@chvQuery='SET QUOTED_IDENTIFIER OFF select * from WO',
@chvWhere=''


-- DUT is specified
If @intErrorCode = 0 and @WODUTFK is not NULL
Begin
set @chvWhere = @chvWhere + 'wo_dutfk = '+@WODUTFK
End



IF @intErrorCode=0 and Len(@chvWhere)>0
Begin
set @chvQuery = @chvQuery + ' WHERE ' + @chvWhere
select @intErrorCode=@@ERROR
END

IF @DEBUG<>0
select @chvQuery Query

IF @intErrorCode=0
Begin
exec (@chvQuery)
select @intErrorCode=@@ERROR
End

return @intErrorCode

GO
---

Any suggestions on how to fix?

Thanks,

peter

View 10 Replies View Related

SQL 2012 :: Parameter Error When Executing A Package With Built In Stored Procedures

Jul 23, 2014

I am using Excel VBA to run a stored procedure which executes a package using the built-in SQL Server stored procedures. The VBA passes two values from excel to the stored proc., which is then supposed to pass these "parameters" to the package to use as a variable within the package.

@Cycle sql_variant = 2
WITH EXECUTE AS 'USER_ACCOUNT' - account that signs on using windows authentication
AS
BEGIN
SET NOCOUNT ON;
declare @execution_id bigint

[code]....

When I try to execute the package, from SQL Server or Excel using the Macro I built, I get the following error:"The parameter '[User::Cycle]' does not exist or you do not have sufficient permissions." I have given the USER_ACCOUNT that runs executes the stored procedure permission to read/write to the database and the SSIS project folder.

View 4 Replies View Related

Error While Creating Inline Function - CREATE FUNCTION Failed Because A Column Name Is Not Specified For Column 1.

Apr 3, 2007



Hi,



I am trying to create a inline function which is listed below.



USE [Northwind]

SET ANSI_NULLS ON

GO

CREATE FUNCTION newIdentity()

RETURNS TABLE

AS

RETURN

(SELECT ident_current('orders'))

GO



while executing this function in sql server 2005 my get this error

CREATE FUNCTION failed because a column name is not specified for column 1.



Pleae help me to fix this error



thanks

Purnima

View 3 Replies View Related

BCP 'bcp' Is Not Recognized

Nov 4, 2004

Hi
I am a bit new to SQL Server so please help me
I am trying to run a simple task at a customer but it doesn't work.
bcp isn't recognized.

I'm running this:
exec xp_cmdshell 'bcp "SELECT top 10 * FROM pubs..authors " queryout "C:Temphej.txt" -c -S [ServerName] -T'
and it givs me this errormess.
'bcp' is not recognized as an internal or external command,

It works fine for me when I'm running it on my computer.

Can anyone please inform me what I'm missing. I haven't got a clue.
BR
Ciotti

View 3 Replies View Related

Custom Url Not Recognized

Sep 3, 2007

i have this action.jumpto url


="javascript:void window.open('http://bklc-crm01:5555/cs/cases/edit.aspx?id={" & cstr(Fields!incidentid.Value) & "}','_self')"



for some reason when i use this field (incidentid.value) there is no hyperlink generated, however when i change the value to another field, the hyperlink works, what shall i be looking for, incident value is a set of number with dashes!

View 1 Replies View Related

Sqlcmd Not Recognized

Oct 9, 2006

Just installed SQL Server 2005 Express along with the Management Studio. The Management Studio, at least what I've seen so far, seems to work fine. But when I type "sqlcmd" at the command prompt, I get "sqlcmd is not a recognized internal or external command, operable program or batch file." What gives???

View 4 Replies View Related

'INT' Is Not A Recognized CURSOR Option.

Jun 18, 2008

HI,
This is my req...
i have to sum up the qty n that qty should be added to qtyonhand in other table....

Declare Qty INT
Qty =SELECT SUM(Quantity) FROM InventoryLedger WHERE ITEMID=@ItemID


UPDATE IW
SET IW.QtyOnHand=IW.QtyOnHand + Qty - @TAllotedQty
FROM InventoryByWarehouse IW
where
IW.CompanyID = @CompanyID
AND IW.DivisionID = @DivisionID
AND IW.DepartmentID = @DepartmentID
AND IW.ItemID=@ItemID

Thanks...

View 20 Replies View Related

'int' Is Not A Recognized CURSOR Option.

Feb 17, 2006

'int' is not a recognized CURSOR option.

I think this error message is related to the fact that I'm using CREATE Table in my stored procedure to handle temporary table data. What can I do to declare a variable here?

CREATE PROCEDURE spTeamPORReport
(@FacilityName nvarchar(50) = NULL,
@CustomerTeamName nvarchar(50) = NULL,
@CustomerName nvarchar(50)=NULL,
@AssemblyPartNumber nvarchar(50)=NULL,
@DateStart smalldatetime,
@DateEnd smalldatetime)
AS
SET NOCOUNT ON

DECLARE MyRecordCount int

CREATE TABLE #FiveWorstPerformance
(PartNumber nvarchar(50),
Customer nvarchar(50),
ProdDesc nvarchar(50),
TestedICT bigint,
FailedICT bigint,
FPYICT float,
TestedAOI bigint,
FailedAOI bigint,
FPYAOI float,
TestedFUNC bigint,
FailedFUNC bigint,
FPYFUNC float,
RecordID identity(1,1) int)


...

Thanks,
Tom

View 4 Replies View Related

BUILTINAdministrators Not Recognized - RsUnknownUserName

Feb 14, 2007

Hello all,

We recently moved our Team Foundation Server from one server to another, of course the reporting services was also included in that move.

On the new server, we are not able to change Reporting Services security parameters anymore, we get this error :
User or group « BUILTINAdministrators » not recognized. (rsUnknownUserName)

The old server was an english windows 2003, the new one a french version, i guess the problem is related. The BUILTINAdministrators group name on the new server is "BUILTINAdministrateurs".

Is there a way to change security params without getting this error ? How can we remove from Reporting Services this reference to BUILDTINAdministrators ? I've tried to modify the table Users directly in ReportServer DB without any success..

Please help !
Alexandre

View 1 Replies View Related

Built-In TargetServerRole

Jul 26, 2001

I recently came across this built-in role in MSDB. It is not documented anywhere except sp_create role stuff. Does anyone know what this role is used for? Is this what gives users that are not dbo or sa access to see jobs?

View 1 Replies View Related

OLE DB For DB2 Built On Dev Run On Standard

Jun 13, 2006

I have built a simple package using the Microsoft OLE DB provider for DB2 with SSIS Developer. If I schedule this on a Standard SQL2005 machine the package will not run. The error is blank, just says it had an error. Can I not run this package because the provider is not installed on this machine? If so is there a work around for this?

View 2 Replies View Related

String Was Not Recognized As A Valid DateTime

Apr 8, 2008

Hi,I am getting this error: String was not recognized as a valid DateTime.I'm trying to insert data into a table from a gridview, where two of the dates can be empty strings.I have set 'allow null' in the SQL Server table for the two dates, added the culture in the web.config file, and even tried converting the values to DBNull.None of which have worked, and I am still getting the error.This is the code I am using: if (e.CommandName == "EmptyInsert")
{
if (Page.IsValid == true)
{
TextBox txtVisitDateIns = GridView2.Controls[0].Controls[0].FindControl("txtVisitDateIns") as TextBox;
TextBox txtNextVisitDateIns = GridView2.Controls[0].Controls[0].FindControl("txtNextVisitDateIns") as TextBox;
TextBox txtVisitedByIns = GridView2.Controls[0].Controls[0].FindControl("txtVisitedByIns") as TextBox;
DropDownList ddlPriorityIns = GridView2.Controls[0].Controls[0].FindControl("ddlPriorityIns") as DropDownList;
TextBox txtMailshotDateIns = GridView2.Controls[0].Controls[0].FindControl("txtMailshotDateIns") as TextBox;

if (txtNextVisitDateIns.Text == "")
txtNextVisitDateIns.Text = DBNull.Value.ToString();
if (txtMailshotDateIns.Text == "")
txtMailshotDateIns.Text = DBNull.Value.ToString();

SPVisitsBLL visits = new SPVisitsBLL();
visits.AddVisit(Convert.ToInt32(GridView1.SelectedValue.ToString()), Convert.ToDateTime(txtVisitDateIns.Text.ToString()),
Convert.ToDateTime(txtNextVisitDateIns.Text.ToString()), txtVisitedByIns.Text.ToString(),
Convert.ToInt32(ddlPriorityIns.SelectedValue.ToString()), Convert.ToDateTime(txtMailshotDateIns.Text.ToString()));
GridView2.DataBind();
}
} I haven't checked txtVisitDateIns to see if it is an empty string as this date is required.Can anyone help?Thanks 

View 5 Replies View Related

String Was Not Recognized As A Valid DateTime PLEASE HELP!!!!!!!!

Sep 16, 2005

I am passing a string to my stored procedure call where I convert it to a DateTime.  I have pasted the relevant code below.  My trouble is that prior to execution of the stored procedure an error is thrown "String was not recognized as a valid DateTime".
The error does not get thrown when I pass it a date, it only throws it when no date is provided. 
The page I am using is a form to do a search.  The search can allow a date to be entered or left out.  How do I catch an empty value in the c# for an invalid datetime and still send the variable to the stored procedure.
////////////////////////////    C# Code /////////////////////////////////// Passing the Date to a stored Procedure SqlParameter bdpDateFrom = new SqlParameter("@datefrom", SqlDbType.DateTime);bdpDateFrom.Value = Convert.ToDateTime(thisbdpDateFrom);myCommand.Parameters.Add(bdpDateFrom);
///////////////////////// Stored Procedure Code //////////////////////////////////@datefrom datetimeIF ((@datefrom IS NOT NULL) AND (@datefrom <>' '))BEGIN     SET @whereclause = @whereclause + ' AND T1.c330101invoicedate_dt  >= ''' +  convert(varchar,@datefrom) + ''''END Thank you!

View 3 Replies View Related







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