|
Use debugger and see what is the value of sCommand.Parameters["@Model"].Value after the assignment.
|
|
|
|
|
it's a string value, i really can not understand why there is a type- mismatch
|
|
|
|
|
I can think of two possibilites. Either the value for the string is NULL or then the value is System.DBNull, but the column is defined as NOT NULL in the database.
|
|
|
|
|
Oledb does not support named parameters like SQL server does.
Your insert staement needs to use the question mark charcter (?) to indicate where a parameter should be substituted - it should expand to this:
"Insert into Run(Site, Model) values( ?, ?)";
The name provided for the parameter is basically irrelevant, only the order they are added to the parameters collection matters. The name can be used as a key ( as you are doing), to modify the OledbParameter properties after adding it to the collection, but it has no meaning in the insert sql statement itself; there you must use the '?' tokens to indicate a parameter.
You have asked this question before[^], and I gave you the same (correct) answer. Why are you still asking this?
|
|
|
|
|
Hello,
I build a report that connect to access file with oledb provider and manage to see a preview of the report in the visual studio development environment.
But in the report server I get error massage: "An error has occurred during report processing.
An attempt has been made to use a data extension 'OLEDB' that is not registered for this report server" when I try to view the report.
(I think it has to do with security because it works fine in the visual studio development environment).
How can I solve this problem?
Thanks in advanced, yaron.
|
|
|
|
|
|
What sql data field is the most suitable to store file navigation url?
comment:my data base is on MS-SQL server 2000.
thanks.
|
|
|
|
|
tomertro wrote: What sql data field is the most suitable to store file navigation url?
Since the url is a string, nvarchar would be a natural choice.
|
|
|
|
|
thanks.
what size do you recommand?
|
|
|
|
|
tomertro wrote: what size do you recommand?
Why limit the size? Define it as long as possible (was it 4000 in SQL Server 200?). If you want you can define a trigger to enforce logic on the column, but I don't see any reason to make limitation on column definition.
|
|
|
|
|
Can a url have unicode characters in it?
I avoid nvarchar like the plague and will only use varchar/char/text unless there is a specific unicode requirement.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Can a url have unicode characters in it?
You're right, as far as I know it cannot not have unicode characters. Varchar could be a better option.
|
|
|
|
|
You can use nvarchar.
SQL server 2000 also supports user defined datatypes. So you can also make your own url datatype.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
I have to tables in SQL Server 2005....
01) EmployeeMaster (DeptId as FK)
02) DepartmentMaster
Now, I am writing a SQL Query which returns me the All Employee from the EmployeeMaster belogs to the "SQL" department.
I manage to write the query but I want result in different manner:
My original result from the SQL is as under:
Result from SQL
--------------------
DeptId DeptCode DeptName EmpId EmpName
D00001 MS00001 SQL E00001 ABC
D00001 MS00001 SQL E00002 EFG
D00001 MS00001 SQL E00003 XYZ
My requirement is
---------------------
DeptId DeptCode DeptName EmpId EmpName
D00001 MS00001 SQL E00001 ABC
E00002 EFG
E00003 XYZ
in my requirement only one row will be displayed.
How can achieve this result by writting SQL Query?
Thanks,
|
|
|
|
|
Chadamama wrote: Result from SQL
--------------------
DeptId DeptCode DeptName EmpId EmpName
D00001 MS00001 SQL E00001 ABC
D00001 MS00001 SQL E00002 EFG
D00001 MS00001 SQL E00003 XYZ
My requirement is
---------------------
DeptId DeptCode DeptName EmpId EmpName
D00001 MS00001 SQL E00001 ABC
E00002 EFG
E00003 XYZ
in my requirement only one row will be displayed.
You have three rows in the data example. Do you mean that you don't want to show repeating values. If that's the case, as far as I know, you can't do it with SQL. You could write a procedure and manipulate the result in the proc.
|
|
|
|
|
Thank you very much!!!
I will try to do in function or Procedure.
your help is precious..
again thank you.
|
|
|
|
|
|
Hello friends suppose I have a table name commitment. That is two field name IsClosed (samll int), IsRejected (small int).
Now I need to run a query that will print "Open" if both (IsClosed & IsRejected) are 0. And will print "Closed" if IsClosed = 1 & IsRejected = 0.And will print "Cancelled" if IsRejected = 1 for each row.
Any help will be really appreciated.
Thanking Advance
Johnny
|
|
|
|
|
If you're using SQL Server, it could be something like:
SELECT
Status =
CASE (IsClosed = 0 AND IsRejected = 0) THEN 'Open'
CASE (IsClosed = 1 AND IsRejected = 0) THEN 'Closed'
CASE (IsRejected = 1) THEN 'Cancelled'
END
FROM Commitment
|
|
|
|
|
|
|
I hope this will help you.
select *,<br />
case when IsRejected = 0 and IsClosed =0 then 'Open' <br />
when IsRejected = 0 and IsClosed =1 then 'Closed'<br />
when IsRejected = 1 then 'Canceled'<br />
end as [Status]<br />
from myTable
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
|
You are welcome.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
suppose My Query Like
Select x.srlNo,x.ProductID from (Select Srlno,ProductID,SaleType from SaleDetail)as x where X.Srlno in (Select Y.SrlNo-1 from(Select SrlNo from SaleDetail
where SaleType=5) as Y)
"It is Just One Row value I am Specify, Actually it is generate Dynamicaly"
How Can I Modifying my field through Case When.
I want to Modify some field of the Current Row with the Privious row data in my Query
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|