Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Friday, March 30, 2012

How to get the value of a SQL query before binding it to DataGrid?

I am using C#.Net, Visual web Developer, SQL server 2000.

I have a SQL query which I am binding it to a DataGrid.

SQL : "SELECT ord_number, ord_ID, ord_split, ord_Name, ETD_Date, OSP_FSD FROM ORDERS"

In My DataGrid I have a dynamic databound column.

I am able to bind one column to this databound column using following code.

BoundColumn ETDDate = new BoundColumn();
ETDDate.HeaderText = "ETD Date";
ETDDate.DataField = "OSP_FSD";
mygrid2.Columns.AddAt(ETDDate);

but now I want to bind this databound column based on the following criteria to two different database columns.

if(ord_split = 1)
{
ETDDate.DataField = "OSP_FSD";
}
else
{
ETDDate.DataField = "ETD_Date";
}

How to get value of ord_split before binding SQL to teh DataGrid? i.e I just want to take value of ord_split and not all the values of SQL.

Please Help!

HI~

ord_split if different in each row but if you change ETDDate.DataField it will affect all rows.

I am afraid you just want to display OSP_FSD for the rows " ord_split =1 " or ETD_Date if not.

If so you can change the text inGridView'sRowDataBound Event.

Wednesday, March 28, 2012

How to get the SQL database size

Is it possible to get the SQL Server database size programmatically?
I have an WEB application in c# ASP NET, but I can found any information about.

Thanks for your attention

Freedeveloperread this post:
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=601604|||Hello!

Ok, Thank for the help.
I resolve the question in microsoft c# forum wit the use of sp_helpdb

SqlCommand cmd = new SqlCommand("sp_helpdb",objConexion);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@.dbname",databasename);

this store procedure return the database size and another data.

thaks,

Freedevelopersql

Wednesday, March 21, 2012

How to get the current date in C# and how do I pass this date to SQL Server

I am writing a ASP.NET C# web application. I will need to store the date in one field in one of my tables. It appears that I need to use the datetime data type for the date in SQL Server 2005.

So I have a question

1.) How do I get today's date in C# and how should this be passed to SQL server?

you can get the current date directly in SQL using getdate()|||Doing it in C# will return you the client system date. Getting the current date in SQL will ensure all datetime recorded in your application are in sync. If you are using the date for some sort of comparison determine the sequence of event, using the date from the client might pose some timing issue. Unless what you want is really the client's local time, you should use the Server time.|||

brgdotnet:

I am writing a ASP.NET C# web application. I will need to store the date in one field in one of my tables. It appears that I need to use the datetime data type for the date in SQL Server 2005.

So I have a question

1.) How do I get today's date in C# and how should this be passed to SQL server?

to get current date in c# use DateTime.Now.ToString()......... there is also some different methods under Now... use what is appropriate for u .


if u r using a procedure it is easier.... say proc. name saveCurrentDate

String s=DateTime.Now.ToString();

String queryString="saveCurrentDate '"+s+"'"; //// or String queryString="insert int myTable(mydate) values ('"+s+"')";

hope it will hellped u


|||

Actually I am processing some records from a comma delimited .txt file. Each item seperated by a comma, will map to a field in a SQL Server database table.

The date is in the format: 20070423, that is YYMMDD

So I need to take the date value and then write it into SQL server. So this brings us to another question. Do I need to change this date format to comply with that of SQL server? If so what format does it need to be in? I need some specifics so if you could even produce a code sample for C#, that would be great.

|||You can pass in the date in format YYYYMMDD as a string. SQL Server will implicitly convert it to string. As long as you are using Universal format YYYYMMDD, it is fine. Other format like MMDDYYYY or DDMMYYYY will be depending on the language setting that you used. So stick to YYYYMMDD and you will not go wrong.|||

I am confused about one thing though? I am reading from a text file where the format is in YYMMDD. Should I store this in SQL server as a data type of datetime or smalldatetime?

If so, I definitely have a date that, I can read from the text file, but I don't have a time? What do you think? If I did use datetime, would it just append the current time to the date I entered?

|||

you should always use proper data type for the data. In this case, you should use datetime or smalldatetime to store the date.

"I can read from the text file, but I don't have a time?"
You can still use datetime data type. Just set the time to 00:00:00. For your case, as your date string is in YYYYMMDD format without time, when you insert into table, the time will be stored as 00:00:00

Monday, March 19, 2012

How to get started

Hi everyone,
I'm a newbie and I want to ask if there are anyone who know some good
books, or even better, a web site that can help me get started with
Microsoft SQL Server. I already know Microsoft Access.
MarcoRead this posted before
1b46b6e12524e645" target="_blank">http://groups.google.com/group/micr...b46b6e12524e645
"marco_r" wrote:

> Hi everyone,
> I'm a newbie and I want to ask if there are anyone who know some good
> books, or even better, a web site that can help me get started with
> Microsoft SQL Server. I already know Microsoft Access.
> Marco
>|||On 10 Oct 2005 13:15:28 -0700, "marco_r" <marcorasmussen@.gmail.com>
wrote:

>Hi everyone,
>I'm a newbie and I want to ask if there are anyone who know some good
>books, or even better, a web site that can help me get started with
>Microsoft SQL Server. I already know Microsoft Access.
>Marco
Marco,
Are you wanting to learn about SQL Server 2000 or SQL Server 2005?
Visit http://www.microsoft.com/events.
Do a search for on-demand (recorded) and upcoming live Webcasts.
Filter on the product that interests you.
It's a great way to get a general feel for a product.
Andrew Watt
MVP - InfoPath|||For beginners also check out:
Sams Teach Yourself Microsoft SQL Server 2000 in 21 Days
by Richard Waymire
http://www.amazon.com/exec/obidos/t...=books&n=507846
Database Design for Mere Mortals
by Michael Hernandez
http://www.amazon.com/exec/obidos/t...=books&n=507846
HTH
Jerry
"SQL" <SQL@.discussions.microsoft.com> wrote in message
news:24CF018A-9A94-442D-B045-4B6F95863C08@.microsoft.com...[vbcol=seagreen]
> Read this posted before
> http://groups.google.com/group/micr...b46b6e12524e645
>
>
> "marco_r" wrote:
>|||Hi,
SQL Server books online will be really good resource for you to understand
the concepts of SQL Server.
Thanks
Hari
SQL Server MVP
"marco_r" <marcorasmussen@.gmail.com> wrote in message
news:1128975328.538494.293880@.z14g2000cwz.googlegroups.com...
> Hi everyone,
> I'm a newbie and I want to ask if there are anyone who know some good
> books, or even better, a web site that can help me get started with
> Microsoft SQL Server. I already know Microsoft Access.
> Marco
>|||Thaks!

How to get started

Hi everyone,
I'm a newbie and I want to ask if there are anyone who know some good
books, or even better, a web site that can help me get started with
Microsoft SQL Server. I already know Microsoft Access.
MarcoRead this posted before
http://groups.google.com/group/microsoft.public.sqlserver.programming/browse_thread/thread/d8fa82c7b4055389/1b46b6e12524e645?lnk=st&q=SQl+Server+Books&rnum=3&hl=en#1b46b6e12524e645
"marco_r" wrote:
> Hi everyone,
> I'm a newbie and I want to ask if there are anyone who know some good
> books, or even better, a web site that can help me get started with
> Microsoft SQL Server. I already know Microsoft Access.
> Marco
>|||On 10 Oct 2005 13:15:28 -0700, "marco_r" <marcorasmussen@.gmail.com>
wrote:
>Hi everyone,
>I'm a newbie and I want to ask if there are anyone who know some good
>books, or even better, a web site that can help me get started with
>Microsoft SQL Server. I already know Microsoft Access.
>Marco
Marco,
Are you wanting to learn about SQL Server 2000 or SQL Server 2005?
Visit http://www.microsoft.com/events.
Do a search for on-demand (recorded) and upcoming live Webcasts.
Filter on the product that interests you.
It's a great way to get a general feel for a product.
Andrew Watt
MVP - InfoPath|||For beginners also check out:
Sams Teach Yourself Microsoft SQL Server 2000 in 21 Days
by Richard Waymire
http://www.amazon.com/exec/obidos/tg/detail/-/0672319691/qid=1128979097/sr=8-2/ref=pd_bbs_2/102-4703055-5891314?v=glance&s=books&n=507846
Database Design for Mere Mortals
by Michael Hernandez
http://www.amazon.com/exec/obidos/tg/detail/-/0201752840/qid=1128979174/sr=8-1/ref=pd_bbs_1/102-4703055-5891314?v=glance&s=books&n=507846
HTH
Jerry
"SQL" <SQL@.discussions.microsoft.com> wrote in message
news:24CF018A-9A94-442D-B045-4B6F95863C08@.microsoft.com...
> Read this posted before
> http://groups.google.com/group/microsoft.public.sqlserver.programming/browse_thread/thread/d8fa82c7b4055389/1b46b6e12524e645?lnk=st&q=SQl+Server+Books&rnum=3&hl=en#1b46b6e12524e645
>
>
> "marco_r" wrote:
>> Hi everyone,
>> I'm a newbie and I want to ask if there are anyone who know some good
>> books, or even better, a web site that can help me get started with
>> Microsoft SQL Server. I already know Microsoft Access.
>> Marco
>>|||Hi,
SQL Server books online will be really good resource for you to understand
the concepts of SQL Server.
Thanks
Hari
SQL Server MVP
"marco_r" <marcorasmussen@.gmail.com> wrote in message
news:1128975328.538494.293880@.z14g2000cwz.googlegroups.com...
> Hi everyone,
> I'm a newbie and I want to ask if there are anyone who know some good
> books, or even better, a web site that can help me get started with
> Microsoft SQL Server. I already know Microsoft Access.
> Marco
>|||Thaks!

How to get started

Hi everyone,
I'm a newbie and I want to ask if there are anyone who know some good
books, or even better, a web site that can help me get started with
Microsoft SQL Server. I already know Microsoft Access.
Marco
Read this posted before
http://groups.google.com/group/micro...46b6e12524e645
"marco_r" wrote:

> Hi everyone,
> I'm a newbie and I want to ask if there are anyone who know some good
> books, or even better, a web site that can help me get started with
> Microsoft SQL Server. I already know Microsoft Access.
> Marco
>
|||On 10 Oct 2005 13:15:28 -0700, "marco_r" <marcorasmussen@.gmail.com>
wrote:

>Hi everyone,
>I'm a newbie and I want to ask if there are anyone who know some good
>books, or even better, a web site that can help me get started with
>Microsoft SQL Server. I already know Microsoft Access.
>Marco
Marco,
Are you wanting to learn about SQL Server 2000 or SQL Server 2005?
Visit http://www.microsoft.com/events.
Do a search for on-demand (recorded) and upcoming live Webcasts.
Filter on the product that interests you.
It's a great way to get a general feel for a product.
Andrew Watt
MVP - InfoPath
|||For beginners also check out:
Sams Teach Yourself Microsoft SQL Server 2000 in 21 Days
by Richard Waymire
http://www.amazon.com/exec/obidos/tg...books&n=507846
Database Design for Mere Mortals
by Michael Hernandez
http://www.amazon.com/exec/obidos/tg...books&n=507846
HTH
Jerry
"SQL" <SQL@.discussions.microsoft.com> wrote in message
news:24CF018A-9A94-442D-B045-4B6F95863C08@.microsoft.com...[vbcol=seagreen]
> Read this posted before
> http://groups.google.com/group/micro...46b6e12524e645
>
>
> "marco_r" wrote:
|||Hi,
SQL Server books online will be really good resource for you to understand
the concepts of SQL Server.
Thanks
Hari
SQL Server MVP
"marco_r" <marcorasmussen@.gmail.com> wrote in message
news:1128975328.538494.293880@.z14g2000cwz.googlegr oups.com...
> Hi everyone,
> I'm a newbie and I want to ask if there are anyone who know some good
> books, or even better, a web site that can help me get started with
> Microsoft SQL Server. I already know Microsoft Access.
> Marco
>
|||Thaks!

Monday, March 12, 2012

How to Get RS Tools for Visual Studio 2003?

The overall question: How do I get the Reporting Services tools for Visual
Studio 2003 if my web hosting company owns the SQL Server?
I am a lone developer with a laptop and a web hosting company. I have Visual
Studio 2003 installed on my laptop (Windows XP Pro). My web host provides me
with .NET, SQL Server 2000, and now Reporting Services. I want to begin to
learn and use Reporting Services.
In searching Microsoft's web site, it seems that I can only obtain the tools
that go into Visual Studio to develop RS reports if I have my own SQL Server
2000. I own a copy of SQL Server 2000 Professional, but I cannot install it
on XP Pro. It requires a server version of Windows. I do have MSDE
installed, but Reporting Services (RSEval.exe) refuses to install on this
version. I don't have access to high priced things like an MSDN universal or
enterprise subscription. I don't qualify for academic versions.
There must be a way for developers like me to get the tools necessary to
create these reports. Any ideas?You do not need to install the server to use the tools (setup will warn you
but you can ignore it). The evaluation version should work fine for you.
--
Brian Welcker
Group Program Manager
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Rick" <rrgrimm@.hotmail.com> wrote in message
news:OjYVHZ2pEHA.2696@.TK2MSFTNGP15.phx.gbl...
> The overall question: How do I get the Reporting Services tools for Visual
> Studio 2003 if my web hosting company owns the SQL Server?
> I am a lone developer with a laptop and a web hosting company. I have
> Visual Studio 2003 installed on my laptop (Windows XP Pro). My web host
> provides me with .NET, SQL Server 2000, and now Reporting Services. I want
> to begin to learn and use Reporting Services.
> In searching Microsoft's web site, it seems that I can only obtain the
> tools that go into Visual Studio to develop RS reports if I have my own
> SQL Server 2000. I own a copy of SQL Server 2000 Professional, but I
> cannot install it on XP Pro. It requires a server version of Windows. I do
> have MSDE installed, but Reporting Services (RSEval.exe) refuses to
> install on this version. I don't have access to high priced things like an
> MSDN universal or enterprise subscription. I don't qualify for academic
> versions.
> There must be a way for developers like me to get the tools necessary to
> create these reports. Any ideas?
>

How To Get Rid Of Sql Log

Hi,
I have a Data base on Sql Server 2000, sp3a. Database is used to to build summary tables to show reports on web. There are many sub systems, which prepare summarized tables for faster web page serving. Every thing is working fine.

The problem is sql server log gets full. In one given day it could go up to 18 GB. I know, if I back it up it gets truncated. Is there a way, I can stop sql server not to log, as it is not needed?

Can I set up Sql server to automatically truncate it. I do have auto shrink options checked, but log file still keeps growing.

Any idea, what is going on here.
Thanks,
Mashro::Is there a way, I can stop sql server not to log, as it is not needed?

You err, it IS needed.

Read up in the documentation what the log is used for. It is needed.|||Back it up regularly to keep it from growing out of control. You can't eliminate the log. It's a pretty key piece of the puzzle. If you have the db set to simple recovery, it should truncate the log on each checkpoint. Probably no need to use a full recovery model on a 'derived' reporting database like you seem to have.

Friday, February 24, 2012

how to get last year revenue up to a specific month

Please help

i have a office web component pivot table that pulls revenue for 2005 ([Measures].[Rev],[Date].[2005]). This shows all revenue to May 2005. I also want to display all revenue for 2004 (up to may).

I was trying to hard code the month but was unsuccessful. Here's what I tried:

([Measures].[Rev], ([Date].[2004].[Quarter 1].[January],[Date].[2004].[Quarter 1].[February],[Date].[2004].[Quarter 1].[March],[Date].[2004].[Quarter 2].[April],[Date].[2004].[Quarter 2].[May]))

..

|||You have to make a calculated member.

Try this
MEMBER [Measures].[Rev To May 2004] AS ' SUM({[Date].[2004].[January]:[Date].[2004].[May]}, [Measures].[Rev]) '
If you want is to always show the same period you should make something like this.
MEMBER [Measures].[Rev To May 2004] AS ' SUM({PARALLELPERIOD([Date].[Year], 1, [Date].CURRENTMEMBER.FIRSTCHILD.FIRSTCHILD : PARALLELPERIOD([Date].[Year], 1, [Date].CURRENTMEMBER}, [Measures].[Rev]) '

(This works if your dimension has these levels year, quarter, month, day
I hope it helps you.

Sunday, February 19, 2012

How to get hold of data from web provider using SQL Server?

I am new to SQL server so apologies if this is a stupid question.
I have a website built and hosted by another company, with SQL server back end data. They don't want to analyse the data but I do. I am familiar with SQL and have SQL server express running on my laptop.
So I was thinking I could get them to send me the data from the server (it will be less than 1GB I imagine), and I could analyse it myself.
So my questions are:
will this work?
and what do I ask them to send me? Is it just a couple of files they have to copy and send me? Or is it more complicated than that?
Many thanks for any advice you can offer.
James

Have them back up the database and send the backup file to you. Restore it on your system and you're ready to go. This will work as long as the version of SQL Server they have (200 or 2005) is equal to or less than the one you have.

Buck Woody

How to get hold of data from web provider using SQL Server?

I am new to SQL server so apologies if this is a stupid question.

I have a website built and hosted by another company, with SQL server

back end data. They don't want to analyse the data but I do. I am

familiar with SQL and have SQL server express running on my laptop.

So I was thinking I could get them to send me the data from the server

(it will be less than 1GB I imagine), and I could analyse it myself.

So my questions are:

will this work?

and what do I ask them to send me? Is it just a couple of files they

have to copy and send me? Or is it more complicated than that?

Many thanks for any advice you can offer.

James

Have them back up the database and send the backup file to you. Restore it on your system and you're ready to go. This will work as long as the version of SQL Server they have (200 or 2005) is equal to or less than the one you have.

Buck Woody