Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Wednesday, March 28, 2012

Mapping image pointers to page numbers

Is there a way to convert an image pointer to a page ID that could be
used in DBCC page

i.e.

select TEXTPTR(document)FROM testdocs where id = 1
resturns
0xFEFF3601000000000800000003000000

select convert(int,TEXTPTR(document)) FROM testdocs where id =1
returns
50331648

dbcc page (9,3,8,1)
dumps the first page of the image

I am trying to map 0xFEFF3601000000000800000003000000 - > page
number 8

thanks"ScottYoder" <scott.yoder@.ngc.com> wrote in message
news:f03d8889.0410011322.6ab77061@.posting.google.c om...
> Is there a way to convert an image pointer to a page ID that could be
> used in DBCC page
> i.e.
> select TEXTPTR(document)FROM testdocs where id = 1
> resturns
> 0xFEFF3601000000000800000003000000
> select convert(int,TEXTPTR(document)) FROM testdocs where id =1
> returns
> 50331648
> dbcc page (9,3,8,1)
> dumps the first page of the image
>
> I am trying to map 0xFEFF3601000000000800000003000000 - > page
> number 8
> thanks

I don't think so - according to BOL, TEXTPTR returns a pointer to the root
of an internal pointer tree. So just having the root pointer may not be
enough to find all the pages in the image, if the internal pointer tree is
not accessible in any way.

"Inside SQL Server 2000" pp 260-266 discusses text/image storage - it might
be useful if you haven't read it already. You seem to be doing something
quite unusual, so if you can give some more details about what your real
goal is, someone might have a better answer.

Simon

Monday, March 12, 2012

Manual Authentication from a Database

Assuming that I have a table [users] in a MSSQL 2005 database. the table has two columns. [userId] and [password].

I have an aspx with C# page with two textboxes and a button.

I want to let the user login or send him an error message if the password or the username does not match from the table in database.

I always made this possible through the template database from administrating the website. but never tried to do it as simple as that. I'm lost here!

How can I do it?

well this is full fledges program you are asking us to write, which of course is not the place, but i can tell you steps you can follow.

1. drop two text boxes on form txtUsername and txtUserPassword

2. Make SQL Connection with your database

3. Write a function that connect to your DB and pass the select query with where clause of user name and password (select * from users where userId = ' + txtUserName + ' and password = ' + txtUserPassword + ')

4. If query return records you can ask your function return true indicates valid user or otherwise bad user.

|||

Is there any usefull link that takes these steps in details? any website of your recommendation! anything?

I have to hand on a project in 12/May that uses this kind of authentication!

|||Hi,

Here's the code you can refer:

The Button1_Click Event:

protected void Button1_Click(object sender, EventArgs e) {string username =this.TextBox1.Text;string password =this.TextBox2.Text;// connstr is the name of connection string you set in Web.Configstring conn = ConfigurationManager.ConnectionStrings["connstr"].ConnectionString; SqlConnection myconn =new SqlConnection(conn); sqltxt ="select * from UserTable where username = '"+username+"' and password = '"+password+"'"; SqlDataAdapter myadpt =new SqlDataAdapter(sqltxt, myconn); DataSet myds =new DataSet(); myadpt.Fill(myds);if (myds.Tables[0].Rows.Count > 0) {// login successfully }else {// error message } }

aspx file:

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
Thanks.

Manipulate Page-Numbers

Hi,

I need to manipulate the page-numbers, I've a dataset with for example 8 Records, where each record has its own page (page break at end) but some Records have 2Pages. So I want that every "first" page of a record gets page-number 1 and for those reports that need two pages the next page should have page-number 2. So in a PDF the page numbers look be like this: 1,1,1,2,1,1,2,3,1,1,1,2...

I tried a custom assembly with a static variable m_page on it which is resettet to 1 in a textfield at the recordbegin (=MyLib.MyClass.resetPage()) and is shown and incrementet in each page footer (=MyLib.MyClass.nextPage()). But when I print that to PDF it seems that the page footers are alltogether generated at the end, so I get numbers from for example 20 to 30 (my report has 10pages).

Is there any possibility? In Access this was quite easy ;(

Sorry bothering you, I should have used the search with the right keywords ;)

The solution is:

http://blogs.msdn.com/bwelcker/archive/2005/05/19/420046.aspx

Saturday, February 25, 2012

Managing DATE ?

Hi,

I have a page that shows some problem indexes (cards ? I don't know the word :/ ) and I want to show only those that are from the current day.

I'm using SQL server 2000. I have a date field inside my table (datetime type). So I tried to put another condition in my WHERE clause. This is:

WHERE something = something else AND mydate = DATEPART('dd', getdate())

or

WHERE something = something else AND mydate = DAY(getdate())

Both don't work..

I wonder if I can really use this in a WHERE clause...of if I'm using them correctly.try:


WHERE mydate BETWEEN CONVERT(datetime,CONVERT(nvarchar(20),GetDate(),101)) AND
CONVERT(datetime,CONVERT(nvarchar(20),DATEADD(day,1,GetDate()),101))

This will get any date/time between midnight last night and midnight tonight.|||That's it, thanks a lot.

But if it is not too much, can I ask why do I have to convert the whole thing (I thought DATE functions could handle datetime type ?) and what does 101 stand for ?|||i'll let douglas answer your question, but I'd be more comfortable with..

" ... WHERE something = something else AND mydate BETWEEN @.StartDate AND @.EndDate"

commandobject.Parameters.Add("@.StartDate", SqlDbType.DateTime);
commandobject.Parameters.Add("@.EndDate", SqlDbType.DateTime);

commandobject.Parameters["@.StartDate"].Value = thestartdatevar;
commandobject.Parameters["@.EndDate"].Value = theenddatevar;|||I presumed that this particular bit of coding was all on the SQL Server box itself. The only reason for using the two dates is so that any entry <b>on a particular day</a> is selected. In the example, he wanted records for today. Thus, no parameters would need to be sent (unless this needs to be generalized).

101 means that the date is formatted mm/dd/yyyy. In thinking about it, 112 (yyyymmdd) would have been better. A DateTime type has both a date AND a time. You are looking to get just a particular date (today in your example).|||Ok.

But is there a way to write a DateTime (like 2004-01-01) and use it with the code you gave me. Because if I want to do an archive of all entries, I have to use specific date (something like clickable month).

I think I should use KraGie code, but how do I initialise DateTime variable ?

For instance, if I want thestartdatevar to be June 1st 2004 (for the moment, because I'll eventually pass the value through a DropDownList or something).

thestartdatevar = ?

PS: Is this C# (the ; ?) ? Because I don't know C#.

Monday, February 20, 2012

Management Studio Summary Page - Reports

Is there a way to add customized reports to the list of reports available via
the Summary page of SQL Server 2005 Management Studio? Or if I wanted to
modify one of the pre-existing reports, is this possible? If so, how?
No and No. This will probably be possible in a future release.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Diana Williams" <Diana Williams@.discussions.microsoft.com> wrote in message
news:DC2D9171-7054-46C3-86FE-399F45731BDC@.microsoft.com...
> Is there a way to add customized reports to the list of reports available
> via
> the Summary page of SQL Server 2005 Management Studio? Or if I wanted to
> modify one of the pre-existing reports, is this possible? If so, how?

Management Studio Summary Page - Reports

Is there a way to add customized reports to the list of reports available via
the Summary page of SQL Server 2005 Management Studio? Or if I wanted to
modify one of the pre-existing reports, is this possible? If so, how?No and No. This will probably be possible in a future release.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Diana Williams" <Diana Williams@.discussions.microsoft.com> wrote in message
news:DC2D9171-7054-46C3-86FE-399F45731BDC@.microsoft.com...
> Is there a way to add customized reports to the list of reports available
> via
> the Summary page of SQL Server 2005 Management Studio? Or if I wanted to
> modify one of the pre-existing reports, is this possible? If so, how?

Management Studio Summary Page - Reports

Is there a way to add customized reports to the list of reports available vi
a
the Summary page of SQL Server 2005 Management Studio? Or if I wanted to
modify one of the pre-existing reports, is this possible? If so, how?No and No. This will probably be possible in a future release.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Diana Williams" <Diana Williams@.discussions.microsoft.com> wrote in message
news:DC2D9171-7054-46C3-86FE-399F45731BDC@.microsoft.com...
> Is there a way to add customized reports to the list of reports available
> via
> the Summary page of SQL Server 2005 Management Studio? Or if I wanted to
> modify one of the pre-existing reports, is this possible? If so, how?