Hi,
I have a StreamReader object that I initialized with a stream, now I want to save this stream to disk (the stream may be a gif or jpg or pdf etc).
SO my code so far is:
StreamReader sr = new StreamReader(myOtherObject.InputStream);
I need to save this to disk (I have the filename).
In the future I may want to store this to sqlserver
I have the encoding type also, which I will need if I store it to sql server right?
I have a table foo and a table bar, where each foo might have a bar (and a bar might belong to multiple foos).
Now I need to select all foos with a bar. My sql looks like this
SELECT * FROM foo f WHERE [...] AND ($param IS NULL OR
(SELECT ((COUNT(*))>0) FROM bar b WHERE f.bar = b.id))
with $param being replaced at runtime.
The question is: Will the subquery be executed even if param is null, or will the dbms optimize the subquery out?
I have a single MYSQL Question and need help ASAP.
Database:
Email | Name | Tag
[email protected] |Test Person | TagOne
[email protected] |Test Person | Tag Two
Need an SQL query that will return
Email | Name | Tag
[email protected] |Test Person | TagOne, Tag Two
Any help?
Is this how hashed password stored in mssql should look like?
This is function I use to hash password (I found it in some tutorial)
public string EncryptPassword(string password)
{
//we use codepage 1252 because that is what sql server uses
byte[] pwdBytes = Encoding.GetEncoding(1252).GetBytes(password);
byte[] hashBytes = System.Security.Cryptography.MD5.Create().ComputeHash(pwdBytes);
return Encoding.GetEncoding(1252).GetString(hashBytes);
}
Thanks,
Ile
I want to query like this:
select * from table where concat(',', ServiceCodes, ',') like '%,33,%';
select * from table where (','||ServiceCodes||',') like '%,33,%';
so, I wrote this code:
ICriteria cri = NHibernateSessionReader.CreateCriteria(typeof(ConfigTemplateList));
cri.Add(Restrictions.Like(Projections.SqlFunction("concat", NHibernateUtil.String, Projections.Property("ServiceCodes")), "%,33,%"));
I get sql similar :
select * from table where (ServiceCodes) like '%,33,%';
But it is not what I want,how to do it???
thanks!
What is the most standard encryption technique used in sql server for asp.net c# enterprise level application? . i am talking with respect to standards like md5 or sh1 etc, hashing
This is probably easy, but eludes me.
SQL server2005
I want to show top 100 but if there are not 100 only want to show those and not include zero counts in the result
SELECT TOP (100) UserName, FullName_Company, FullName,
(SELECT COUNT(*)
FROM dbo.Member_Ref
WHERE (RefFrom_UserName = dbo.view_Members.UserName) AND (RefDate >= '5/1/2010') AND (RefDate <= '6/1/2010'))
AS RefFromCount
FROM dbo.view_Members
WHERE (MemberStatus = N'Active')
ORDER BY RefFromCount DESC
I have tried using Group By and HAVING COUNT(*)0 all with the same wrong results
Hi,
Is there any way to cache LINQ to SQL queries by looking at the parameters that were previously passed and bypass the database all together?
I know L2S caches some database calls, but I'm looking for a permanant solution as in, even if the applciation restarts, that cache reloads and never asks the database again.
Are there any frameworks for C#?
MS SQL Server has a TABLE data type which can be used in stored procedures,
Does anybody know if MySQL has an equivalent data type?
I've had a look over the docs but can't seem to find anything, so I presume it doesn't exist, but perhaps somebody has created a workaround
Hi,
I have following SQL tables.
ImportantMessages
impID
Message
ImportantMessageUsers
imuID
imuUserID
imuImpID
I want to write a Linq2Sql query so that it returns any rows from ImportantMessages
that does not have a record in ImportantMessagesUsers.
Matchiing fields are
impID ----- imuImpID
Assume imuUserID of 6
I am using SQLite,
TABLE A
(
ID
FileNAME
FOLDERID
)
TABLE B
(
FOLDERID
FOLDERPATH
)
I want to write a sql statement to delete all files in A where its Folder is subfolder of C:\ABC\;
How Can I make it in one sqlite statement, and is it the best way to do?
Many thanks!
i am trying to create a statement in sql (for a table which holds stock symbols and price on specified date) with avg of 5 day price and avg of 15 days price for each symbol.
table description:
symbol
open
high
close
date
the average price is calculated from last 5 days and last 15 days. i tried this for getting 1 symbol:
SELECT avg(close),
avg(`trd_qty`)
FROM (select *
from cashmarket
WHERE symbol = \'hdil\'
order by `M_day` desc
limit 0,15 ) s
...but I couldn't get the desired the list for showing avg values for all symbols.
I need to use C# to get data from database(sql) and the data in database is updated every few seconds. So do I have to make a loop or there is a better way to do that? Is it possible that when database is updating, the program can wait until it finishes updating? thx!
I have a asp:GridView with a HyperLinkField. It's DataNavigateUrlFormatString property is set to View.aspx?id={0}&isTechnical={1}
Select command of appropriate SqlDataSource returns columns of type INT and BYTE (from SQL Server 2008).
So displayed string becomes something like View.aspx?id=1&isTechnical=1. But I want to display isTechnical=true|False, i.e. Convert.ToBoolean(row["isTechnical"]).ToString().ToLowerInvariant().
How to implement such conversion in page markup?
I am using linq to sql
Currently i am binding gridviw through linq which query written in business logic call .
i have extract record through query in business logic class and i want to bind that particular data to gridviw and return data .
how to retrun data which type is array.
code is mention below:
CMSBusiness.DataClasses1DataContext db = new DataClasses1DataContext();
var cate = from p in db.categoryTables
select new
{
categoryId=p.categoryId,
categoryName=p.categoryName,
categoryDesc=p.categoryDesc
};
how to return value and bind gridview , Please suggest
I am wondering how I can add DATA LINK form to my WIN application.
You know those forms where Users can choose on witch SQL server they going to connect
and what type of security they going to use and on wht database.
Something like on this picture
hi
please help i have a sharepoint site with sql connection i am able to view the info on the page but other sharepoint users in the company cant how can i add them on as users to my database? , my connection string on my page is as follows :
con = new SqlConnection("server=srvgmssapqas;database=hrportal2;Trusted_Connection=True");
Hello,
are there free, recommendable Tools for data modeling?
ERM/ORM Diagrams
Creating database models (SQL SERVER
2005)
Simple to use like Visio(no license
here)
Code generation is only a nice to
have (VB.Net)
Hi,
have select like
select trn_dt,collect(ac_no) from transactions where rownum < 1000
group by trn_dt
i'm doing it in SQL Navigator. But i can't export results!
Table collect(ac_no) is not exported. Is there any way out?
I had a table (Some_Table) with two columns:
A B
-------------------
1 test
2 test
3 test1
4 test1
i would like to return DISTINCT values for column B and it's associated value in column A (first in distinct set), so something like this:
A B
-----------
1 test
3 test1
What is the sql?
I have the following SQL query which returns the correct results:
SELECT *
FROM `tags`
WHERE tag_name = '???\\\"?-???????'
If I change it to
SELECT *
FROM `tags`
WHERE tag_name LIKE '???\\\"?-???????'
or to
SELECT *
FROM `tags`
WHERE tag_name LIKE '???\\\"?-???????%'
It doesn't work. It will work if I remove all the backslashes and " from the query.
hello,
i am developing wpf application..
i need your suggestions.
i have to make reports in my application...
so which one is best, by crystal report or by using sql server reporting service..
friends what you say ? give ur suggestion which one is best and why ???