Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Sunday, March 25, 2012

Automatically reformat SQL Keywords to UPPER CASE

Is there a way to get SQL 2000 Query Analyzer or Visual Studio 2003 to
automatically re-format SQL keywords to upper case as you type?
I can do this in Ultra-Edit by editing an external file that contains all of
the keywords.
Thanks.Not uppercase specifically, you probably know this , but you can customise
keywords through the tools|options|fonts
For uppercase , check this:
http://www.aquafold.com/docs-qw-sqlformatter.html
--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm
___________________________________
"SOG1" <SOG1@.discussions.microsoft.com> wrote in message
news:E3AB7C4C-7F22-4C42-9ABB-40D80AF5E820@.microsoft.com...
> Is there a way to get SQL 2000 Query Analyzer or Visual Studio 2003 to
> automatically re-format SQL keywords to upper case as you type?
> I can do this in Ultra-Edit by editing an external file that contains all
of
> the keywords.
> Thanks.|||I recently bought a license for PromptSQL, a tool that does just that along
with Intellisense, and works with several tools including Query Analyzer and
SQL Server Management Studio. A couple of ws ago, Red Gate Software bough
t
the product, renamed to SQL Prompt, and is currently in beta for release 3.
I'm not sure what you can get right now, but you can try www.promptsql.com,
or Red Gates site, www.red-gate.com to see.
HTH
Vern
"SOG1" wrote:

> Is there a way to get SQL 2000 Query Analyzer or Visual Studio 2003 to
> automatically re-format SQL keywords to upper case as you type?
> I can do this in Ultra-Edit by editing an external file that contains all
of
> the keywords.
> Thanks.

Sunday, March 11, 2012

Automatic Field Entry

Hi,

I'm creating a database using SQL Server 2005 Express Edition (Comes with Visual Web Developer). The table which I am creating has the following Fields - all don't allow nulls:

ID
UserId
Date
Description

(UserId is a foreign key to asp_net_Users as I am supporting user accounts)

Basically what I need to do is create a page where I as an Administrator can log onto and enter just the text for the field Description. Then once I upload this I wish all users to visit the site and view this Description on a page however with it also listing the Administrator who wrote it along with the Date. I wish both of these fields to be added automatically (UserId to display the User Name and the Date to display the date and time with which the Description was added - However these need to be editable by the Administrator if he/she wishes to change them).

Can anyone point me in the right direction on the steps needed to create this scenario?

Thanks for any help

Daniel

I'm a bit confused on how you plan on getting the UserID? Is this actually coming from the membership provider in asp.net or are you storing it somewhere else? As far as the Date field you can set the default value of that field on the SQL side to getDate(). This will populate the field with the timestamp whenever you enter in a row into the database. Even though you set a default value you can always pass in your own date/time to your UPDATE statement if you want if you need to edit it.

|||

wtroom:

I'm a bit confused on how you plan on getting the UserID? Is this actually coming from the membership provider in asp.net or are you storing it somewhere else? As far as the Date field you can set the default value of that field on the SQL side to getDate(). This will populate the field with the timestamp whenever you enter in a row into the database. Even though you set a default value you can always pass in your own date/time to your UPDATE statement if you want if you need to edit it.

To be fully accurate, getDate() returns a datetime datatype value that is set to the current date and time.

It's dangerous to mix in the word "timestamp" into such a discussion because timestamp is also a sql server datatype. A timestamp datatype does NOT contain a date or a time and so cannot be used for this purpose.

|||

Hi,

Thanks for your help. The UserId is coming from the Membership provider in asp.net.

I'm relatively new to ASP.NET and am struggling to implement the getDate() on the SQL side. I have created the SQL Datasource to return the table and have then tried to add a WHERE statement.

I assume that the column needs to Date and the Operator = however I am unsure on the control and parameter properties. I have played around and tried Control and QueryString for the Control property and then added getDate() to the Parameter Property Default Value however this just breaks the Details view which is attached to the SQL Datasource.

Any more help would be greatly appreciated.

Thanks

Daniel


|||thanks for your help but I managed to fix this problem.

for the username I created a label with the Id UserIdValue and deleted the text and turned visible to false.

I then added code for the label onload

 Protected Sub UserIdValue_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles UserIdValue.Load UserIdValue.Text = Membership.GetUser().UserName.ToString() End Sub

This made the label display my username when logged on.

The next part for the detailsview code for iteminserting I added

Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles DetailsView1.ItemInserting
e.Values("Writtenby") = Membership.GetUser().UserName
e.Values("Date") = DateTime.Now
End Sub

I then deleted Writtenby and Date fields from the details view.

Now when I insert and enter only title and description the Writtenby and Date fields are automatically updated.

Daniel

Thursday, March 8, 2012

AUTOMATED EXAMINAMTION

PLZZZ HELP ME FIFURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...
PLZZZ HELP ME FIGURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...
|||http://www.databaseanswers.org/data_models/index.htm
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Janmar" wrote:

> PLZZZ HELP ME FIFURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
> USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...

AUTOMATED EXAMINAMTION

PLZZZ HELP ME FIFURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...PLZZZ HELP ME FIGURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...|||http://www.databaseanswers.org/data_models/index.htm
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Janmar" wrote:
> PLZZZ HELP ME FIFURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
> USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...

AUTOMATED EXAMINAMTION

PLZZZ HELP ME FIFURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...PLZZZ HELP ME FIGURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...|||http://www.databaseanswers.org/data_models/index.htm
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Janmar" wrote:

> PLZZZ HELP ME FIFURE OUT MY DATABASE FOR MY AUTOMATED EXAMINATION PROJECT
> USING SQL AS DATABASE AND VISUAL BASIC 6 or VB.NET...

Wednesday, March 7, 2012

automate Access project connection to MSDE database

I'm using Visual C++ to insert records into my MSDE database. I'd like the
user to be able to view the data via Access projects. In my application, is
it possible to configure the connection settings for an Access project to
connect to the MSDE database? For example, if I were to click the View button
in my application, can I have Access project connect to the database behind
the scenes and then display the contents of the database?
Thanks!
You can use automation to launch Access and display forms and reports.
I'm not a C++ programmer, so I couldn't tell you *how* to do that.
However, I'm not sure I really understand what you are trying to do.
The phrase, "display the contents of the database" covers a lot of
ground. Perhaps you can be more specific.
--Mary
On Fri, 4 Feb 2005 15:13:02 -0800, "luv2travel"
<luv2travel@.discussions.microsoft.com> wrote:

>I'm using Visual C++ to insert records into my MSDE database. I'd like the
>user to be able to view the data via Access projects. In my application, is
>it possible to configure the connection settings for an Access project to
>connect to the MSDE database? For example, if I were to click the View button
>in my application, can I have Access project connect to the database behind
>the scenes and then display the contents of the database?
>Thanks!
|||When you create a new access project that connects to an existing database
there are certain settings that the wizard asks of you before connection to
the database can be made. How do I pass those parameters from my application
to access project? Once the project has been created after the connections
settings have been configured, the user will have full access to the tables
within the database. The user can then create queries and reports as needed.
Does this explain things a little better?
"Mary Chipman [MSFT]" wrote:

> You can use automation to launch Access and display forms and reports.
> I'm not a C++ programmer, so I couldn't tell you *how* to do that.
> However, I'm not sure I really understand what you are trying to do.
> The phrase, "display the contents of the database" covers a lot of
> ground. Perhaps you can be more specific.
> --Mary
> On Fri, 4 Feb 2005 15:13:02 -0800, "luv2travel"
> <luv2travel@.discussions.microsoft.com> wrote:
>
>
|||When you create a new access project, there are connection settings that need
to be configured before a connection can be made. How do I pass those
parameters to the connection wizard via my application? Once the connection
is made to the MSDE database, Access will then display all the tables in the
database. The user can then generate queries or reports as needed. Forms are
not necessary because if I were to create custom forms I would have created
it within my application instead of connecting to an Access database. The
reason I chose to use Access project is because I'd like the users to be able
to create queries and reports of their choosing. My job is just to dump the
data into the table and have them decide on the type of queries and reports
to generate. Is this more clear?
"Mary Chipman [MSFT]" wrote:

> You can use automation to launch Access and display forms and reports.
> I'm not a C++ programmer, so I couldn't tell you *how* to do that.
> However, I'm not sure I really understand what you are trying to do.
> The phrase, "display the contents of the database" covers a lot of
> ground. Perhaps you can be more specific.
> --Mary
> On Fri, 4 Feb 2005 15:13:02 -0800, "luv2travel"
> <luv2travel@.discussions.microsoft.com> wrote:
>
>
|||I understand now. However, your choice to use an Access project is a
bad one. Users will not be able to create and save local queries
(although they can save local reports). You would need to grant them
permissions to create views or stored procedures on the server, and
this you probably don't want to do for two reasons: (1) security and
(2) clogging the server with a lot of user objects. Unless a user is
connected as a sysadmin, they will own all their own objects and will
need to grant others permissions to use them, which you don't want to
get into. In your situation, I'd use an .mdb. You can programmatically
link tables at runtime using DAO, and if users create their own
queries, they are saved locally, not on SQL Server. HTH,
Mary
On Sun, 6 Feb 2005 23:03:08 -0800, "luv2travel"
<luv2travel@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>When you create a new access project, there are connection settings that need
>to be configured before a connection can be made. How do I pass those
>parameters to the connection wizard via my application? Once the connection
>is made to the MSDE database, Access will then display all the tables in the
>database. The user can then generate queries or reports as needed. Forms are
>not necessary because if I were to create custom forms I would have created
>it within my application instead of connecting to an Access database. The
>reason I chose to use Access project is because I'd like the users to be able
>to create queries and reports of their choosing. My job is just to dump the
>data into the table and have them decide on the type of queries and reports
>to generate. Is this more clear?
>"Mary Chipman [MSFT]" wrote:

Monday, February 13, 2012

Auto Print

I am using Visual studio 2005. This may be a vb question but it deals with reporting services.

I have a local report using the reportviewer control. (rdcl 2005 fmt)

It displays perfectly, and when i click the print button it prints flawlessly.

How do i print the document to the default printer automatically?

This seems like a basic function that i can't seem to find the answer to.

Thanx

Jerry Cicierega

I found the answer. Its not as bad as it looks. Thois is a form called "slip.vb" I am printing to a slip printer. The form has a rpt viewer on it. The form nevers shows. It is just used as a containor for the report. I created the report as an RDL report. I coppied it into the program folder and re-named it to a RDCL extension. I then established the datasource. and it worked interactivly. I then added the following code and presto. Auto Print. I also asume the default printer is the printer of choice.

Imports System.IO

Imports System.Data

Imports System.Text

Imports System.Drawing.Imaging

Imports System.Drawing.Printing

Imports System.Collections.Generic

Imports Microsoft.Reporting.WinForms

Public Class Slip

Private m_currentPageIndex As Integer

Private m_streams As IList(Of Stream)

Public Sub Print_Slip()

Me.TxnHistoryTableAdapter.Connection.ConnectionString = My.Utilities.ConnectionString

Me.TxnHistoryTableAdapter.FillBy(Me.PCZonDataSet.TxnHistory, My.GlobalVariables.ComputerData.ComputerName, My.GlobalVariables.ComputerData.Sequencenumber)

Export(Me.ReportViewer1.LocalReport)

m_currentPageIndex = 0

Print()

End Sub

Private Function CreateStream(ByVal name As String, _

ByVal fileNameExtension As String, _

ByVal encoding As Encoding, ByVal mimeType As String, _

ByVal willSeek As Boolean) As Stream

Dim stream As Stream = New FileStream(name + "." + fileNameExtension, FileMode.Create)

m_streams.Add(stream)

Return stream

End Function

Private Sub Export(ByVal report As LocalReport)

Dim deviceInfo As String = _

"<DeviceInfo>" + _

" <OutputFormat>EMF</OutputFormat>" + _

" <PageWidth>9in</PageWidth>" + _

" <PageHeight>11in</PageHeight>" + _

" <MarginTop>0.0in</MarginTop>" + _

" <MarginLeft>0.0in</MarginLeft>" + _

" <MarginRight>0.25in</MarginRight>" + _

" <MarginBottom>0.25in</MarginBottom>" + _

"</DeviceInfo>"

Dim warnings() As Warning = Nothing

m_streams = New List(Of Stream)()

report.Render("Image", deviceInfo, _

AddressOf CreateStream, warnings)

Dim stream As Stream

For Each stream In m_streams

stream.Position = 0

Next

End Sub

Private Sub Print()

If m_streams Is Nothing Or m_streams.Count = 0 Then

Return

End If

Dim printDoc As New PrintDocument()

AddHandler printDoc.PrintPage, AddressOf PrintPage

printDoc.Print()

If Not (m_streams Is Nothing) Then

Dim stream As Stream

For Each stream In m_streams

stream.Close()

Next

m_streams = Nothing

End If

End Sub

Private Sub PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)

Dim pageImage As New Metafile(m_streams(m_currentPageIndex))

ev.Graphics.DrawImage(pageImage, ev.PageBounds)

m_currentPageIndex += 1

ev.HasMorePages = (m_currentPageIndex < m_streams.Count)

End Sub

End Class