|
Open surface area configurations of SQL server and allow remote connections. It seems that you haven't enabled them up till now that's why network users can't connect to your database.
|
|
|
|
|
I am running the following MS ACCESS select command from a c# method.
SELECT USERINFO.USERID, CHECKINOUT.CHECKTIME, CHECKINOUT.CHECKTYPE, DEPARTMENTS.DEPTNAME, USERINFO.NAME FROM (CHECKINOUT INNER JOIN USERINFO ON CHECKINOUT.USERID = USERINFO.USERID) INNER JOIN DEPARTMENTS ON USERINFO.DEFAULTDEPTID = DEPARTMENTS.DEPTID WHERE CHECkINOUT.CHECKTIME BETWEEN @fromDate and @toDate " + sensors + "ORDER BY DEPARTMENTS.DEPTNAME;"
The problem is that the parameters that I am passing, which are in date format are throwing an ivalid criteria exception. This is how I am passing the parameters
cmd.Parameters.AddWithValue("fromDate", todayDate);
cmd.Parameters.AddWithValue("toDate", tomorrowDate);
Can one identify why it is telling me ivalid criteria when the values should be dates?
|
|
|
|
|
jonhbt wrote: The problem is that the parameters that I am passing, which are in date format are throwing an ivalid criteria exception. This is how I am passing the parameters
cmd.Parameters.AddWithValue("fromDate", todayDate);
cmd.Parameters.AddWithValue("toDate", tomorrowDate);
You didn't use @ with the parameter.
Here is you modified code,
cmd.Parameters.AddWithValue("@fromDate", todayDate);
cmd.Parameters.AddWithValue("@toDate", tomorrowDate);
This will help you
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
It didn't work either it is showwing me the following error.
{System.Data.OleDb.OleDbException: Data type mismatch in criteria expression
|
|
|
|
|
If you step through the code and hover over todayDate and tomorrowDate what are there values?
|
|
|
|
|
Do you find any difficulties to use Add() Function,
cmd.Parameters.Add("@fromDate", SqlDbType.System.Data.SqlDbType.Date)
cmd.Parameters.Item(0).Value = todayDate;
Using Add() function you can avoid datatype conflicts here.
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
To explain the problem definition let me take a simple example. Lets say I have a report with Year as the parameter. So when i go to the report i have to select the year from a dropdownlist and click 'View report' button to view the report. assuming that for each year there are millons of records, I don't want to wait for long time for the report to show.
I know there is a caching and snapshot history features in SQL reporting services. But in both ways it would cache or save snapshot of report only for default value of parameter specified or for a particular report requested with selected parameter. It will not cache or snapshot for all possible parameter combinations. In my example i have taken only one parameter 'Year' and it may have lets say 10 values(2000-2009). But if i have another report with 'Year' and 'Month' parameters, then there would be 120 (10x12) possible reports combinations.
So my requirement is to some how(programatically or using web service or any other way) cache or snapshot all these possible reports using various combinations of parameters for a particular report.
Also would like to mention that the possible values for a parameter may also come from database. Like for 'Year' we might get the various values possible from a table in our database.
This requirement is so that user do not have to wait for long time when he requests a report with any parameter selected. This is to be done using SQL Reporting Services. Cheers!
s.a.w.
|
|
|
|
|
|
Can someone tell me what's wrong with this code? Basically the sp takes in one parameter and is creating a new record in tbl_swbom_checklist the values, with the package variable being set by the parameter, the rest being set by tbl_swbom_checklist_template entries.
CREATE PROCEDURE dbo.sp_CreateChecklistForPackage
(
@PACKAGE varchar(255)
)
AS
INSERT INTO TBL_SWBOM_CHECKLIST
(
PACKAGE,
TEMPLATEOWNER,
STEPNUMBER,
STEPNAME,
DESCRIPTION,
LASTCHANGE,
LASTCHANGEBY
)
values
(
@PACKAGE,
SELECT
TEMPLATEOWNER,
STEPNUMBER,
STEPNAME,
DESCRIPTION,
LASTCHANGE,
LASTCHANGEBY
FROM SWManagement.dbo.TBL_SWBOM_CHECKLIST_TEMPLATES
)
GO
|
|
|
|
|
Try this
INSERT INTO TBL_SWBOM_CHECKLIST
(
PACKAGE,
TEMPLATEOWNER,
STEPNUMBER,
STEPNAME,
DESCRIPTION,
LASTCHANGE,
LASTCHANGEBY
)
select
@PACKAGE,
TEMPLATEOWNER,
STEPNUMBER,
STEPNAME,
DESCRIPTION,
LASTCHANGE,
LASTCHANGEBY
FROM SWManagement.dbo.TBL_SWBOM_CHECKLIST_TEMPLATES
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
With that one, I get an error I had before in my ASP page from calling this procedure:
"Conversion from string "" to type 'Double' is not valid."
Does that mean some of the types of the columns in the databases don't match? Also confusing to me is that none of the columns are of type string or double. (I'm fairly new to SQL)
Thanks kindly for your help.
|
|
|
|
|
Actually, nevermind, I figured it out. Thanks!
|
|
|
|
|
How do I check that or restrict the row to be selected if same row is modified by other user.
For eg. I have created following table.
Consider below tables;
1. Bills Table
Fields Description
BillNo - Bill No Unique (Primary) - No duplicates allowed.
Customer - Customer Name -Non Blank
BillAmt - Bill Total -Not Empty & Only Positive Values
Collected - Collection Done against this bill No Negative Values & shud never be more than BillAmt
2. Collection Table
Fields Description
RcptNo - Receipt No. Unique (Primary) - No duplicates allowed.
RcptAmt - Receipt Total - Cheque / Collection Value.
3. Col_Ref Table - Collection Reference, A Child Table for Collection to store its referred (multiple) bills.
Fields Description
RcptNo - Receipt No. Unique (Primary) - No duplicates allowed.
Ref_BillNo - Referred Bill No.
Ref_Billamt - Referred Bill Amount
I have some records. for eg.
1) I have Bill no. 00001 with amount 10,000/- in Bills Table.
At the same time another user is accessing Collection Table and referring the same Bill no. and accepts receipts and updating amount in Collection table in Bills table.
If user is accessing Bill number he will not get actual amount of collection so i want to restict user for viewing the Bill number which is getting modified by another user using Receipt option in web application. The back end will sql server 2005. How do I do that ?
Before allowing the Edit, Check if the record this invoice is not locked, only then lock the same & allow editing of this entry only for the Invoice Amount & later on <> / <> release the lock. Otherwise Pop message "Update is in progress for this entry, try again later..."
Please guide.
Thanks in advance.
|
|
|
|
|
You may want to consider using your own locking logic with the help of "sp_getapplock".
http://msdn.microsoft.com/en-us/library/ms189823.aspx[^]
Be very careful when implementing a locking strategy you may bring your entire application to a screeching halt if locks are not released in a timely manner.
You may want to use the sp_getapplock as a method to warn users that a particular account is being updated and not place any hard locks. You could also use this to indicate who has the "lock".
Good luck.
|
|
|
|
|
hi Friends i have a problem
i have a two tables
1.Customer
2,Purchases
customer table has [ Customer_id(int),name(varchar)]
purchases table has [ purchase_no(int)(identity),Customer_id(int),Delivered(bool)]
i will all the custmor_id's in string format
and i want to update the delivered field in the purchases table with bool =1 and
customer_id with split function
i am using this query - where fnSlplit is spliting the customer_id
into table format but not updating the purchases table
UPDATE purchases SET Delivered= 1
INNER JOIN dbo.fnSplit(@CustomerList,',') AS S
ON
REDEMPTION_CODE = S.ID
WHERE REDEMPTION_CODE = S.ID
please help to solve this problem.
|
|
|
|
|
I could be wrong, but I think you need to do the split function first, store that in a variable, and then use that variable for the update. You have S.ID in the inner join and in the where clause--you need one or the other.
I have not tried this, but something along these lines:
DECLARE @newCustID VARCHAR(10)
SET @newCustID = dbo.fnSplit(@CustomerList,',')
UPDATE purchases SET Delivered = 1
WHERE REDEMPTION_CODE = @newCustID
Hope it helps.
|
|
|
|
|
Which Version of SQL Server are you using.
In SQL Server 2008, you can pass Table Value Parameter to your stored procedure and in such a case no need to pass delimited string of ID's.
If not, you need to create a Table Variable and store the IDs in the Table Variable first using the Split UDF and then use the same in the statement. Also you can iterate through your table of IDs and then update the purchases table.
|
|
|
|
|
Hi
This is Mahesh, working as a technical Lead for performance testing & engineer activities.
Currently I am working on e -learning application which was developed in .net & Classic ASP.
During performance testing I am facing some issues with MSMQ performance for overloaded of messages.
I need to monitor the applciation for MSMQ is there any freeware performance monitoring tools available in the market.
What are basic performance counters needs to monitor for MSMQ?
If anyone has the exp in MSMQ please share with me.
I am awaiting for your kind response.
Thank you,
Mahesh
|
|
|
|
|
Google MSMQ Monitor--you will find lots of helpful results there.
|
|
|
|
|
hi all,
this is my oracle StoredProcedure
PROCEDURE PEAP_SelectActiveYear
(
Cur_RCT1 OUT GLOBALPKG.RCT1
)
AS
BEGIN
OPEN Cur_RCT1 FOR
SELECT ActiveYear
FROM PeapParameters;
RETURN;
END;
in the code am trying to fetch the value using ExecuteScalar()
but not retrieving
Anything need to be changed to the procedure?
|
|
|
|
|
I don't use Oracle but try removing the RETURN, this should then get the result set back instead of trying to RETURN any output parameters (of which there are NONE).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello brothers
Just i m designing for helpdesk product.
jsut think about . i have one department
Department(Admin)
.
.
...... SupportTeams ( Support Teams having Support Users)
.
........ SupportUser1
.
........ SupportUser2 and so....
User Team1(Means developer)
,
......User1
.
..... User2
User Team2(Means developer)
,
......User1
.
..... User2
Now my question is i want to give security for this tree structure.
..> Department Admin can access to all Like Support Teams and USer teams.
..> Support Teams can Access to Only Userteams Member.
..> Userteams Member can aceess only his profiles.
Now can u tell me how could i create table for these flow tree structure.
Some Thing need 2 do NEW
|
|
|
|
|
What best you can do is to create one table like
ID DepartMent DepartMentData
and make DepartMentData column as xml type where you will store data in
the hierarchal way.
For eg.
There is an admin department so the DepartMentData column may have values like
<Department Name = "Admin">
------<SupportTeams>
----------<SupportUser Name ="SupportUser1" ID="1">
--------------<DeveloperTeam1>
------------------<User Name ="Dev1User1" ID="1"/>
------------------<User Name ="Dev1User2" ID="2"/>
--------------</DeveloperTeam1>
----------</SupportUser>
----------<SupportUser Name ="SupportUser2" ID="2"/>
--------------<DeveloperTeam2>;
------------------<User Name ="Dev2User1" ID="1"/>
------------------<User Name ="Dev2User2" ID="2"/>
---------------</DeveloperTeam2>
-----------</SupportUser>
------</SupportTeams>
</Department >
Now in C# code you could pass the element you want to read Like for eg. you want to read all the users below SupportTeams then you just need to
call:
XmlNodeList ChilNodes = doc.GetElementsByTagName("SupportTeams")
This will return all the child nodes including SupportTeams node.
Now you can iterate through for each node
foreach (XmlNode cNode in ChilNodes )
{
}
In the loop check that each node has further any child node by calling:
if(cNode.ChilNodes!= null)
This way you could ensure that you have not gone to above in the tree hierarchy.
This will always go to below in the tree hierarchy.
|
|
|
|
|
If you are using SQL 2008 (you don't mention the database) look into the hierarchy ID and it's methods.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|