Thursday, March 22, 2012
A way to add .Net classes in a report?
I have a project with a .vb class, that, when accessing a web page, based on
the user's login, I grab their Employee ID. With that, I can conceivably
create a method to get a list of employees who report to that person
Is there a way to include a .vb class in a report project, and then, access
a particular method (in this case, getting the list of direct reports), in
the document map?Elmo,
I have done something similar. You should be able to create a reportviewer
in an aspx page and access your class in the aspx code...pass the subsequent
values to the report.
billN
--
Message posted via http://www.sqlmonster.com|||Will I be able to use the same report file (.rdl) that I designed in a
Report Server Project in BI?
I tried adding a .rdl file to a ReportViewer control one time, and it wasn't
recognized.
"wnichols via SQLMonster.com" <u3357@.uwe> wrote in message
news:7e587ee1771a4@.uwe...
> Elmo,
> I have done something similar. You should be able to create a
> reportviewer
> in an aspx page and access your class in the aspx code...pass the
> subsequent
> values to the report.
> billN
> --
> Message posted via http://www.sqlmonster.com
>
Friday, February 24, 2012
A question about db relationships
Is that true?
Thanks in advance,
venusgirlwhat moron told you that?|||Many developers are leary of Foreign Key relationships becase it "takes away" some of the control they have in the app area. During the development phase of a new project, it can also be a pain to clear out data in a table that has foreign keys enabled.
I am not aware of any (significant) performance penalty that foreign keys impose on a database. They are of tremendous value long term in maintaining relational integrity and for a host of other reasons.
In the end, Brett's assessment is...er...rather more to the point, but spot on.
Regards,
hmscott|||So I see that there's no performance problems in creating my database with foreign keys. :) Thanks guys.
One more question, that could be applied to any database or only to SQL Server?
Thanks,
venusgirl|||There is always some perofrmance cost associated with foreign keys, because the database needs to do a lookup to ensure that the parent row exists. That cost is normally trivial, and compared to the human cost of doing without foreign keys it is always trivial.
Some databases impose a higher "performance price" than others for implementing foreign keys, but I've never seen one where that cost was material. Compared to the hours of maintenance time and the uncertainty of the users when a system runs without foreign key definitions, I see them as cheap.
-PatP|||"Data Sanitation" after the horse has left the barn is a very time consuming thing.
I like the fact that I don't have to believe or rely on developers who say they will "take care of everything"
They always lie
DB2/Oracle/SQL Server and most database management systems take care of RI.
I wonder about MySQL though... I really should play with that...which is what this board is based on I believe|||All current (post 4.0) flavors of MySQL can declare RI (referential integrity). At least one of the flavors of MySQL (InnoDb) can actually enforce RI. Very few of the MySQL implementations that I've seen use a file engine that can actually enforce RI even though they can declare it, which makes me really uncomfortable.
-PatP|||What's the point of declaring RI if it's not enforced?|||What's the point of declaring RI if it's not enforced?It makes lovely documentation?
-PatP|||Really, this thread could have stopped with Brett's first post.
But...MySql can't enforce relationial integrity? I had no idea. In my opinion a database without primary or foreign keys is not a database. It is a datapile.|||But...MySql can't enforce relationial integrity? I had no idea. In my opinion a database without primary or foreign keys is not a database. It is a datapile.Not exactly... MySQL actually supports mutliple (at least three) file formats for holding data. One of those formats (InnoDb) allows you to support DRI.
The "Front End" for MySQL always supports DRI syntax (at least since version 4.0), whether or not the currently selected back end will enforce the DRI or not.
I've never seen an ISP host InnoDB, but that doesn't mean that none of them host it. InnoDb is considerably more complex to manage, and resource intensive than MyISAM. Because of this choice that is commonly made by implementers in the name of speed and ease of maintenance, MySQL gets a bad name.
-PatP
Sunday, February 19, 2012
A Query
I am working on a project where I had to upload data from Excel
file into SQL Server.
Now the problem is that the data in Excel sheet can have any
data(garbage) ,the data entered may not have any significance to the
data already present in the database.
e.g I have an Author table
I have an Titles table
Now if I try to upload data present in Excel sheet which contains
Author name and title .It should show me all exceptions like
title is empty Author is not present in the Author Table etc.
My Solution
What I am doing is loading all the data into a temporary table checking
for not null , length of fields (using cursor) etc.
If null value exist then stop the upload
otherwise
One by one pick the data from the table (temporary) then insert into
another table (which can be used for updation purpose becuase not all
records are going to be incorrect) now this table has trigger for
insert
Now each column is checked for the integrity constraints [ referential
,check etc ]
With present Solution if my upload has 18 fields and probable
combination of 60 exceptions [ referential ,check etc ] and my upload
excel file has 20000 records It will take nearly 16 Hours and still
going.
Can you suggest me a better method the present method is killing my
application
With Warm Regards
JatinderYou don't need to validate row by row. Two inserts should do it:
/* the valid rows... */
INSERT INTO TargetTable (author_name, foo_name, bar_name, ...)
SELECT DISTINCT S.author_name, S.foo_name, S.bar_name, ...
FROM StagingTable AS S
JOIN Authors AS A
ON S.author_name = A.author_name
JOIN foo AS F
ON S.foo_name = F.foo_name
JOIN bar AS B
ON S.foo_name = B.foo_name
WHERE ... / * domain checks go here */
/* ... and the invaid ones */
INSERT INTO ExceptionTable (author_name, foo_name, bar_name, ...)
SELECT DISTINCT S.author_name, S.foo_name, S.bar_name, ...
FROM StagingTable AS S
LEFT JOIN Authors AS A
ON S.author_name = A.author_name
LEFT JOIN foo AS F
ON S.foo_name = F.foo_name
LEFT JOIN bar AS B
ON S.foo_name = B.foo_name
WHERE A.author_name IS NULL
OR F.foo_name IS NULL
OR B.bar_name IS NULL
OR ... / * domain checks go here */
--
David Portas
SQL Server MVP
--|||Thanks David,
This will surely help me solve the problem.
I was thinking of the SET BASED Solution but could not figure out one
..Thanks again
It is not be related to the post but can you suggest some ways to
improve performance of an ASP page.
With warm regards
Jatinder
Thursday, February 16, 2012
A Probelm with sqlConnection Command ....
I have met a problem in the ASP.NET project creation with SQL Server Database Connection.
"Can't Login to My ServerName/ASPNET
How to solve the problem?
You need to give the ASPNET account a login and permissions to your database in SQL Server.Thursday, February 9, 2012
a full-text search engine
Hi
I'm working on a digital Library project. Can anybody suggest a powerfulAsp.net full-text search engine Script or guide?
Thanks
Hi,
If you're using SQL Server as the database, I would suggest the Microsoft Full-Text Engine for SQL Server.
The Microsoft Full-Text Engine for SQL Server (MSFTESQL) service is a full-text indexing and search engine. The MSFTESQL engine is built on Microsoft Search (MSSearch) technology and is integrated into the Microsoft SQL Server 2005 Database Engine more tightly than ever.
Please check the following link for more information
http://msdn2.microsoft.com/en-us/library/ms142587.aspx
HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!
|||Thanks for your reply,
I use SQL Server 2005 and I don't think Microsoft Full-Text Engine is suitable for me because I don't want my search engine search the files. All of our books will scan with OCR components and the full text of books will extract into a "NTEXT" field of the bank. I want a search engine for searching the "NTEXT" field efficiently.
Meanwhile I use a shared hosting plan on internet and can't use Administrator role for database.
Can you suggest any solution?
Thank you very much
A float data type is recognized as varchar
I am on a c# project right now. If I want to insert a float data type (c#)
into the sql server, I am getting the message then, that a varchar cannot be
inserted into a float. I tried it with money, small money and decimal, too.
And the result is ever the same. (Varchar cannot be entered into a
float/decimal, money etc..)
I am using direct sql command, not a SP.
As example: (simplified, without connection opening, etc.)
In c#:
float variable = 20;
sqlcommandobject.commandtext = "insert into products (price) VALUES
('"+variable+"')"Why are you putting the value between apostrophes?
> sqlcommandobject.commandtext = "insert into products (price) VALUES
> ('"+variable+"')"
sqlcommandobject.commandtext = "insert into products (price) VALUES
(" + variable + ")"
AMB
"the friendly display name" wrote:
> Hello,
> I am on a c# project right now. If I want to insert a float data type (c#)
> into the sql server, I am getting the message then, that a varchar cannot
be
> inserted into a float. I tried it with money, small money and decimal, too
.
> And the result is ever the same. (Varchar cannot be entered into a
> float/decimal, money etc..)
> I am using direct sql command, not a SP.
> As example: (simplified, without connection opening, etc.)
> In c#:
> float variable = 20;
> sqlcommandobject.commandtext = "insert into products (price) VALUES
> ('"+variable+"')"
>
>|||Get rid of the single quotes around the value, e.g.
sqlCommandObject.CommandText =
"INSERT INTO PRODUCTS (price) VALUES (" + variable.ToString() + ")"
Better yet, use parameters in your query so that it will automatically do
the formatting for you, this is also more flexible for data types like
binary, etc. and you don't have to worry about escaping text strings::
sqlCommandObject.CommandText =
"INSERT INTO PRODUCTS (price) VALUES (@.var)";
sqlCommandObject.Parameters.Add("@.var", variable);
Mike
"the friendly display name"
<thefriendlydisplayname@.discussions.microsoft.com> wrote in message
news:26A40CD8-45CE-4149-BF00-6064A0741640@.microsoft.com...
> Hello,
> I am on a c# project right now. If I want to insert a float data type (c#)
> into the sql server, I am getting the message then, that a varchar cannot
> be
> inserted into a float. I tried it with money, small money and decimal,
> too.
> And the result is ever the same. (Varchar cannot be entered into a
> float/decimal, money etc..)
> I am using direct sql command, not a SP.
> As example: (simplified, without connection opening, etc.)
> In c#:
> float variable = 20;
> sqlcommandobject.commandtext = "insert into products (price) VALUES
> ('"+variable+"')"
>
>|||Thank you.
The parameters solved the problem.
"Mike Jansen" wrote:
> Get rid of the single quotes around the value, e.g.
> sqlCommandObject.CommandText =
> "INSERT INTO PRODUCTS (price) VALUES (" + variable.ToString() + ")"
> Better yet, use parameters in your query so that it will automatically do
> the formatting for you, this is also more flexible for data types like
> binary, etc. and you don't have to worry about escaping text strings::
> sqlCommandObject.CommandText =
> "INSERT INTO PRODUCTS (price) VALUES (@.var)";
> sqlCommandObject.Parameters.Add("@.var", variable);
> Mike