Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Friday, March 30, 2012

help in crystal report & dataset

I'm the new beginer in C#,I have some problem in doing crystal report:
In my application I have 2 form named Form1 and Form2.
I create one dataset named ds in Form1 and in Form2 I want to creat a crystal report that displays the data in the dataset ds in Form1.
I relly get stuck.Can anyone help me?
Thanx b4 hand!See if you find answer here
www.asp.net
http://support.businessobjects.com/sql

Wednesday, March 28, 2012

help forms

The below stored procedure works. However, I am trying to use a text box
from a temp form for the where clause.
WHERE Transactions.TransactionID = [forms]![form1]![text0]
I even tried changing first line:
Alter PROCEDURE S3 @.TID varchar (255) = [forms]![form1]![text0]
And changed last line to:
WHERE Transactions.TransactionID = @.TID
So far, I haven't been able to have this parameter work from a temp form
with the parameter typed into the text0 box.
any help here? I get ado error near "!" or something to that affect.

this below is what does work fine:

Alter PROCEDURE S3 @.TID varchar (255)
AS
SELECT Transactions.TransactionID, Transactions.AccountID,
Transactions.TransactionNumber, Transactions.TransactionDate,
Transactions.TransactionDescription, Transactions.WithdrawalAmount,
Transactions.DepositAmount
FROM Transactions
WHERE Transactions.TransactionID = @.TID"JIMMIE WHITAKER" <kpsklab@.worldnet.att.net> wrote in message
news:sHfGc.196809$Gx4.122482@.bgtnsc04-news.ops.worldnet.att.net...
> The below stored procedure works. However, I am trying to use a text box
> from a temp form for the where clause.
> WHERE Transactions.TransactionID = [forms]![form1]![text0]
> I even tried changing first line:
> Alter PROCEDURE S3 @.TID varchar (255) = [forms]![form1]![text0]
> And changed last line to:
> WHERE Transactions.TransactionID = @.TID
> So far, I haven't been able to have this parameter work from a temp form
> with the parameter typed into the text0 box.
> any help here? I get ado error near "!" or something to that affect.
> this below is what does work fine:
> Alter PROCEDURE S3 @.TID varchar (255)
> AS
> SELECT Transactions.TransactionID, Transactions.AccountID,
> Transactions.TransactionNumber, Transactions.TransactionDate,
> Transactions.TransactionDescription, Transactions.WithdrawalAmount,
> Transactions.DepositAmount
> FROM Transactions
> WHERE Transactions.TransactionID = @.TID

SQL Server is a pure server application - it doesn't know anything about
forms or other presentation of data. You need to capture the parameter value
in your client application (Access?), then pass it to the stored procedure
using a client library such as ADO. If you're unsure how to go about this,
you might want to post in a forum for whichever client application you have.

Simon|||I thought sql server was about sql. You're saying there's no way to pass
data from a form to it as a parameter?
"Simon Hayes" <sql@.hayes.ch> wrote in message
news:40e99857$1_2@.news.bluewin.ch...
> "JIMMIE WHITAKER" <kpsklab@.worldnet.att.net> wrote in message
> news:sHfGc.196809$Gx4.122482@.bgtnsc04-news.ops.worldnet.att.net...
> > The below stored procedure works. However, I am trying to use a text
box
> > from a temp form for the where clause.
> > WHERE Transactions.TransactionID = [forms]![form1]![text0]
> > I even tried changing first line:
> > Alter PROCEDURE S3 @.TID varchar (255) = [forms]![form1]![text0]
> > And changed last line to:
> > WHERE Transactions.TransactionID = @.TID
> > So far, I haven't been able to have this parameter work from a temp form
> > with the parameter typed into the text0 box.
> > any help here? I get ado error near "!" or something to that affect.
> > this below is what does work fine:
> > Alter PROCEDURE S3 @.TID varchar (255)
> > AS
> > SELECT Transactions.TransactionID, Transactions.AccountID,
> > Transactions.TransactionNumber, Transactions.TransactionDate,
> > Transactions.TransactionDescription, Transactions.WithdrawalAmount,
> > Transactions.DepositAmount
> > FROM Transactions
> > WHERE Transactions.TransactionID = @.TID
> SQL Server is a pure server application - it doesn't know anything about
> forms or other presentation of data. You need to capture the parameter
value
> in your client application (Access?), then pass it to the stored procedure
> using a client library such as ADO. If you're unsure how to go about this,
> you might want to post in a forum for whichever client application you
have.
> Simon|||JIMMIE WHITAKER (kpsklab@.worldnet.att.net) writes:
> I thought sql server was about sql. You're saying there's no way to pass
> data from a form to it as a parameter?

You are right SQL Server is about SQL, but forms are not SQL per se.

The difference between Access and SQL Server is that Access is a one-tier
application. That is, the query language knows about the GUI and can
interact with it directly. This makes it very easy to write application,
but it comes with a price: it does not scale well, and is best suited for
single-user applications. Also, since the application accesses the database
directly, that means a lot of network traffic if the database is on the
other machine.

SQL Server is intended for applications with two or more tiers. That is,
there is a client on one machine, which passes queries or remote procedure
calls to the server which sends data back. Since machine that hosts the
database does not have do care about drawing GUI:s it can concentrate
on managing the data. And since the server program works on the server,
only the data that the user actually requests has to travel the network.

There are of course several ways to pass a parameter from a form to SQL
Server, but the point is that once the parameter reaches SQL Server, SQL
Server has no idea where it came from. It could be from an input form, it
could have been a read from a file, or it could be a constant in the calling
client program.

To talk to SQL Server from a client, there is a whole range of client
libraries to choose from. From Access the most commonly used today is
ADO. But really how you this best in Access, is probably a question
for comp.databases.ms-access.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Wednesday, March 21, 2012

Help Converting Character string to smalldatetime data type

I am attempting to pass a string variable from a form to an SQL statement an
d
I get this error "Syntax error converting character string to smalldatetime
data type"
Your assistance is appreciated in advance....
Here is my code
<%
Dim TESTTHIS__MMColParam1
TESTTHIS__MMColParam1 = "0"
If (Request.Form("StartDate") <> "") Then
TESTTHIS__MMColParam1 = Request.Form("StartDate")
End If
%>
<%
Dim TESTTHIS__MMColParam2
TESTTHIS__MMColParam2 = "0"
If (Request.Form("EndDate") <> "") Then
TESTTHIS__MMColParam2 = Request.Form("EndDate")
End If
%>
<%
Dim TESTTHIS
Dim TESTTHIS_numRows
Set TESTTHIS = Server.CreateObject("ADODB.Recordset")
TESTTHIS.ActiveConnection = MM_CSSMetricsCONN_STRING
TESTTHIS.Source = "SELECT Team, SumofInAdherenceSecsQty /
(SumofInAdherenceSecsQty + SumofOutOfAdherenceSecsQty) AS Adherence FROM
(SELECT TOP 1000 Team, SUM(OutOfAdherenceSecsQty) AS
SumofOutOfAdherenceSecsQty, SUM(InAdherenceSecsQty) AS
SumofInAdherenceSecsQty FROM bo.[National Call Stats] WHERE (Site =
'Dallas') AND ([Date] >='" + Replace(TESTTHIS__MMColParam1, "'", "''") + "')
AND ([Date] <= '" + Replace(TESTTHIS__MMColParam2, "'", "''") + "')
GROUP BY Team, Site ORDER BY Team, Site) DERIVEDTBL"
TESTTHIS.CursorType = 0
TESTTHIS.CursorLocation = 2
TESTTHIS.LockType = 1
TESTTHIS.Open()
TESTTHIS_numRows = 0
%>
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200606/1Run a Profiler trace to see the actual select statement being sent to SQL
Sever. Also, consider using parameters instead of concatenating values.
Parameters are more secure and you don't have to double-up embedded quotes.
Hope this helps.
Dan Guzman
SQL Server MVP
"Chamark via webservertalk.com" <u21870@.uwe> wrote in message
news:6168f7c85cf47@.uwe...
>I am attempting to pass a string variable from a form to an SQL statement
>and
> I get this error "Syntax error converting character string to
> smalldatetime
> data type"
> Your assistance is appreciated in advance....
> Here is my code
> <%
> Dim TESTTHIS__MMColParam1
> TESTTHIS__MMColParam1 = "0"
> If (Request.Form("StartDate") <> "") Then
> TESTTHIS__MMColParam1 = Request.Form("StartDate")
> End If
> %>
> <%
> Dim TESTTHIS__MMColParam2
> TESTTHIS__MMColParam2 = "0"
> If (Request.Form("EndDate") <> "") Then
> TESTTHIS__MMColParam2 = Request.Form("EndDate")
> End If
> %>
> <%
> Dim TESTTHIS
> Dim TESTTHIS_numRows
> Set TESTTHIS = Server.CreateObject("ADODB.Recordset")
> TESTTHIS.ActiveConnection = MM_CSSMetricsCONN_STRING
> TESTTHIS.Source = "SELECT Team, SumofInAdherenceSecsQty /
> (SumofInAdherenceSecsQty + SumofOutOfAdherenceSecsQty) AS Adherence FROM
> (SELECT TOP 1000 Team, SUM(OutOfAdherenceSecsQty) AS
> SumofOutOfAdherenceSecsQty, SUM(InAdherenceSecsQty) AS
> SumofInAdherenceSecsQty FROM bo.[National Call Stats] WHERE (Site =
> 'Dallas') AND ([Date] >='" + Replace(TESTTHIS__MMColParam1, "'", "''") +
> "')
> AND ([Date] <= '" + Replace(TESTTHIS__MMColParam2, "'", "''") + "')
> GROUP BY Team, Site ORDER BY Team, Site)
> DERIVEDTBL"
> TESTTHIS.CursorType = 0
> TESTTHIS.CursorLocation = 2
> TESTTHIS.LockType = 1
> TESTTHIS.Open()
> TESTTHIS_numRows = 0
> %>
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...amming/200606/1|||Also keep in mind that if something is a valid date it still might not
be able to be converted into smalldatetime (for example dates before
19000101 and after 20790606)
Denis the SQL Menace
http://sqlservercode.blogspot.com/
Chamark via webservertalk.com wrote:
> I am attempting to pass a string variable from a form to an SQL statement
and
> I get this error "Syntax error converting character string to smalldatetim
e
> data type"
> Your assistance is appreciated in advance....
> Here is my code
> <%
> Dim TESTTHIS__MMColParam1
> TESTTHIS__MMColParam1 = "0"
> If (Request.Form("StartDate") <> "") Then
> TESTTHIS__MMColParam1 = Request.Form("StartDate")
> End If
> %>
> <%
> Dim TESTTHIS__MMColParam2
> TESTTHIS__MMColParam2 = "0"
> If (Request.Form("EndDate") <> "") Then
> TESTTHIS__MMColParam2 = Request.Form("EndDate")
> End If
> %>
> <%
> Dim TESTTHIS
> Dim TESTTHIS_numRows
> Set TESTTHIS = Server.CreateObject("ADODB.Recordset")
> TESTTHIS.ActiveConnection = MM_CSSMetricsCONN_STRING
> TESTTHIS.Source = "SELECT Team, SumofInAdherenceSecsQty /
> (SumofInAdherenceSecsQty + SumofOutOfAdherenceSecsQty) AS Adherence FROM
> (SELECT TOP 1000 Team, SUM(OutOfAdherenceSecsQty) AS
> SumofOutOfAdherenceSecsQty, SUM(InAdherenceSecsQty) AS
> SumofInAdherenceSecsQty FROM bo.[National Call Stats] WHERE (Site =
> 'Dallas') AND ([Date] >='" + Replace(TESTTHIS__MMColParam1, "'", "''") + "')
> AND ([Date] <= '" + Replace(TESTTHIS__MMColParam2, "'", "''") + "')
> GROUP BY Team, Site ORDER BY Team, Site) DERIVEDTB
L"
> TESTTHIS.CursorType = 0
> TESTTHIS.CursorLocation = 2
> TESTTHIS.LockType = 1
> TESTTHIS.Open()
> TESTTHIS_numRows = 0
> %>
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...amming/200606/1|||I am able to see that it is getting to the server because I get a return of
the column headers but I am not getting any data. When I hard code the dates
in the query works fine. I am sending for example 8/1/2005 from the form. If
I take out the two / and send 812005 I get an overflow error?
Dan Guzman wrote:
>Run a Profiler trace to see the actual select statement being sent to SQL
>Sever. Also, consider using parameters instead of concatenating values.
>Parameters are more secure and you don't have to double-up embedded quotes.
>
>[quoted text clipped - 43 lines]
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200606/1|||On Wed, 07 Jun 2006 20:12:46 GMT, "Chamark via webservertalk.com"
<u21870@.uwe> wrote:

>I am able to see that it is getting to the server because I get a return of
>the column headers but I am not getting any data. When I hard code the date
s
>in the query works fine. I am sending for example 8/1/2005 from the form. I
f
>I take out the two / and send 812005 I get an overflow error?
You will get an error, as '812005' does not convert to datetime:
select convert(datetime,'812005')
Server: Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.
The most reliable format for a date string is YYYYMMDD:
select convert(datetime,'20050801')
--
2005-08-01 00:00:00.000
Roy Harvey
Beacon Falls, CTsql

Help cannot connect to SQL Server 2000

I'm trying to build a simple form using SQL Server 2000 and am having trouble establishing a connection to my database. I was able to build and successfully test my connection in Server Explorer. But when I try to open the connection in my app I keep getting a "Login failed for user xxx" error message. I'm using standard Windows NT security. Would appreciate any help.If you are using Windows security, when you are testing in Server Explorer, you are using your Security Context. The ASP.NET page is useing the ASPNET user's security context, so if you want to use Windows security, you must add the ASPNET Windows user to SQL Server. If you have Enterprise Magager, expand out the database and right click on users, and then New database User. The dialog from there is mostly self explanitory. Let us know if you have any other questions.|||Thanks Douglas that did the trick!

Wednesday, March 7, 2012

HELP - insert record SQLExpress database

Hi! i ask you some help..I should build a simple INSERT FORM in a SQLExpress database..

but clicking ADD I have this error :

Incorrect syntax near '='.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Incorrect syntax near '='.

Source Error:

Line 38: conDatabase.Open()Line 39:Line 40: cmdInsert.ExecuteNonQuery()Line 41: Line 42: conDatabase.Close()

some solution?

the source code:

<%

@.PageLanguage="VB"Debug="true"%>

<%

@.ImportNamespace="System.Data"%>

<%

@.ImportNamespace="System.Data.SqlClient"%>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

scriptrunat="server">Sub Button_clic(ByVal sAsObject,ByVal eAs EventArgs)Dim conDatabaseAs SqlConnectionDim strInsertAsStringDim cmdInsertAs SqlCommandDim myExecuteQueryAsStringDim myExecuteCmdAs SqlCommand

conDatabase =

New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Inetpub\wwwroot\tesi\App_Data\database.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")

strInsert =

"Insert pubblicazioni (Nome, Cognome, Titolo) Values = (@.Nome, @.Cognome, @.Titolo) "

cmdInsert =

New SqlCommand(strInsert, conDatabase)

cmdInsert.Parameters.Add(

"@.Nome", txtNome.Text)

cmdInsert.Parameters.Add(

"@.Cognome", txtCognome.Text)

cmdInsert.Parameters.Add(

"@.Titolo", txtTitolo.Text)

conDatabase.Open()

cmdInsert.ExecuteNonQuery()

conDatabase.Close()

Response.Redirect(

"success.html")EndSub

</

script>

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headid="Head1"runat="server"><title>iNSERIMENTO</title><LINKhref="mauro.css"rel=stylesheet>

<

scripttype="text/javascript"language="javascript">

<!--

function

popopen(){

window.open(

"upload/upload.aspx","name"," toolbar=no,directories=no,menubar=no,width=300,height=300,top=100,left=150,resizable=no,scrollbars=yes");

}

// -->

</

script>

</

head>

<

bodybgcolor="#DFE5F2"style="font-size: 12pt"><formid="form1"runat="server"><div> <asp:LabelID="Label1"runat="server"BackColor="#8080FF"BorderColor="Black"ForeColor="Black"Height="29px"Text="FORM INSERIMENTO DOCUMENTO"Width="371px"Font-Bold="True"Font-Names="Verdana"Font-Size="14pt"Font-Underline="True"></asp:Label><br/><br/><br/><B><spanstyle="font-family: Verdana">NOME </span></B><asp:TextBoxID="txtNome"runat="server"></asp:TextBox> <B><spanstyle="font-family: Verdana">COGNOME </span></B><asp:TextBoxID="txtCognome"runat="server"></asp:TextBox><br/><br/><B><spanstyle="font-family: Verdana">TITOLO </span></B><asp:TextBoxID="txtTitolo"runat="server"></asp:TextBox><br/><br/>

<ahref="javascript:popopen()">CARICA DOCUMENTO</a><br/><br/>

<asp:ButtonID="Button1"runat="server"OnClick="Button_Clic"Text="ADD"Font-Bold="True"Font-Names="Verdana"Font-Size="12pt"Width="160px"/></div><br><br></form>

</

body>

</

html>Remove the "=" sign in the INSERT statement.|||

ndinakar:

Remove the "=" sign in the INSERT statement.

damn!ehehehe ; ) thanks you....

Monday, February 27, 2012

Help - Best way to store related data (across or down)?

Good day.
I have a form with approx 90 related components. All 90 components are
associated with an App_ID. An App_ID can occur more than once but with
different data from the 90 fields.
I simply cannot decide whether to store the data from each component in
it's own column or as a separate row.
Any suggestions would be greatly appreciated.
Thanks!
*** Sent via Developersdex http://www.examnotes.net ***I think you hit on the key word here "related". To me that automatically
implies that you would set up a separate, but related, table to contain your
90 components. Without knowing more than you said about your app, I would
probably store each related component in its own row in the second table.
My assumption is that not all 90 components would necessarily be populated
for all App_ID's and that if, in the future, you add a 91st component you
don't necessarily want to change your whole schema.
Here's some example DDL. It contains 3 related tables, Apps which contains
your AppID and other App-specific info, AppComponents which contains an
App-specific component list, and LookupComponents which contains
Component-specific information (in this case just ComponentID and Name):
CREATE TABLE [dbo].[AppComponents] (
[AppID] [int] NOT NULL ,
[ComponentID] [int] NOT NULL
)
GO
CREATE TABLE [dbo].[Apps] (
[AppID] [int] NOT NULL ,
[Name] [varchar] (50) NULL
)
GO
CREATE TABLE [dbo].[LookupComponents] (
[ComponentID] [int] NOT NULL ,
[Name] [varchar] (50) NULL
)
GO
ALTER TABLE [dbo].[AppComponents] WITH NOCHECK ADD
CONSTRAINT [PK_AppComponents] PRIMARY KEY CLUSTERED
(
[AppID],
[ComponentID]
)
GO
ALTER TABLE [dbo].[Apps] WITH NOCHECK ADD
CONSTRAINT [PK_Apps] PRIMARY KEY CLUSTERED
(
[AppID]
)
GO
ALTER TABLE [dbo].[LookupComponents] WITH NOCHECK ADD
CONSTRAINT [PK_LookupComponents] PRIMARY KEY CLUSTERED
(
[ComponentID]
)
GO
ALTER TABLE [dbo].[AppComponents] ADD
CONSTRAINT [FK_AppComponents_Apps] FOREIGN KEY
(
[AppID]
) REFERENCES [dbo].[Apps] (
[AppID]
),
CONSTRAINT [FK_AppComponents_LookupComponents] FOREIGN KEY
(
[ComponentID]
) REFERENCES [dbo].[LookupComponents] (
[ComponentID]
)
GO
"bajan_rick" <bajanrick@.devdex.com> wrote in message
news:eaMBbw1QFHA.4028@.tk2msftngp13.phx.gbl...
> Good day.
> I have a form with approx 90 related components. All 90 components are
> associated with an App_ID. An App_ID can occur more than once but with
> different data from the 90 fields.
>
> I simply cannot decide whether to store the data from each component in
> it's own column or as a separate row.
>
> Any suggestions would be greatly appreciated.
> Thanks!
>
> *** Sent via Developersdex http://www.examnotes.net ***|||>> I have a form with approx 90 related components. All 90 components
are associated with an App_ID. An App_ID can occur more than once but
with different data from the 90 fields. <<
Do not confuse the forms that collect data with the data model and the
tables in the schema. If they are all attributes of the same entity,
then they belong in one row in the table. If a subset of columns is
another entity, then it needs to be in its own table.
Then we have to ask if "app_id" is really a key or not. It sounds like
a sequential form number (remember the "Bates Numbering Stamp" in the
old days?) that has nothing to do with the data model, but is used for
data collection control.
Without any real information, it is imposible to give specific advice.
But a while a 90 column table is possible, it is rare. I would guess
-- I mean guess -- that this is really a 5 to 6 column schema.
The worst thing you can do is build an EAV design or some other variant
that mixes data and metadata in the name of a "flexible" design. They
fall aprt in about a year of production work after running insanely
slow.|||Thanks guys.
I'm not if I can explain the app anymore. I guess it's more like a
spreadsheet where there is the possiblit of multiple rows being
represented by 1 App_ID (PK).
My table is currently:
CREATE TABLE [dbo].[App_Sheet] (
[SheetID] [int] NOT NULL ,
[AppID] [int] NOT NULL ,
[Component_ID] [int],
[Value] [varchar] (50) NULL
)
GO
CELKO:
What do you mean by
"..this is really a 5 to 6 column schema"
*** Sent via Developersdex http://www.examnotes.net ***