Form With 20,500 Fields

Jan 27, 2004

I'm running SQL Server 2000. I have an interesting form I am creating for a client which has on it literally 20,500 fields that need to be stored in the system which I then have to create reports off of for statistics and trends.

I'm not sure how I should go about storing that large amount of information in SQL Server with the limitations of the size of a table. Would it be best to create 20 some tables to store it, or is there a better fashion to store it. 90% of the fields are numbers ranging from 0 to 100.

Thanks for any suggestions you can come up with!

View 14 Replies


ADVERTISEMENT

Fields Of Form In The ReportViewer Report

Jun 19, 2007

Hi,



I have a report (rdlc) in my WinForm project that the data are filtered in accordance with two dates: Initial and End. These two dates, the user inform in a Form of the project. Well, what I need I am to inform in the report these two dates. How that I make to pass these two dates of form for the report?



Thank you!

View 4 Replies View Related

What Is The Best Way To Build The Search Based On Form Fields

Oct 5, 2007

I required to build the search feature for my application which contains combination of at least 20 search fields e.g firstname, lastname. date of birth, sign up date ,etc... I am just wondering what is the best way to do it ,should I create stored procedure with 20 input parameters or should I build it based on each search fields. I need to provide the search results via web services. Could anyone help me?
Thank you

View 5 Replies View Related

When Submitting Form, SQL Server Fields Only Show The First Letter

Nov 30, 2005

Hi, I'm new around here and am stumped.  I have created a form where I submit the information into a SQL Server 2000 table.  When I submit the information through the form, only the first character of each field populates inside of the SQL table.  This happens for every field except for two, zip and comments.  The zip field is numeric and the comments field is text.  All the other fields are varchar fields; and these are the fields with the problems.  I have attempted to change the data type to text, but that did not work either.  I am doing this through a stored procedure I created.  Here is the asp code:
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents txtFirstName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtLastName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAddress1 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAddress2 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCity As System.Web.UI.WebControls.TextBox
Protected WithEvents txtZip As System.Web.UI.WebControls.TextBox
Protected WithEvents txtEmail As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPhone As System.Web.UI.WebControls.TextBox
Protected WithEvents txtComments As System.Web.UI.WebControls.TextBox
Protected WithEvents ddlState As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlGift1 As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlGift2 As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlGift3 As System.Web.UI.WebControls.DropDownList
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection()
Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand()
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "data source=NDAVENPORT2;initial catalog=Bluestreak;integrated security=SSPI;persi" & _
"st security info=False;workstation id=NDAVENPORT2;packet size=4096"
'
'SqlCommand1
'
Me.SqlCommand1.CommandText = "dbo.[InsertFreeOrders]"
Me.SqlCommand1.CommandType = System.Data.CommandType.StoredProcedure
Me.SqlCommand1.Connection = Me.SqlConnection1
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, False, CType(10, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@firstname", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@lastname", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@address1", System.Data.SqlDbType.VarChar, 100))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@address2", System.Data.SqlDbType.VarChar, 100))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@zip", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, False, CType(18, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@email", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@phone", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@item1", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@item2", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@item3", System.Data.SqlDbType.VarChar, 50))
Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@comments", System.Data.SqlDbType.VarChar, 2147483647))
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If IsValid Then
SqlCommand1.Parameters("@firstname").Value = txtFirstName.Text
SqlCommand1.Parameters("@lastname").Value = txtLastName.Text
SqlCommand1.Parameters("@address1").Value = txtAddress1.Text
SqlCommand1.Parameters("@address2").Value = txtAddress2.Text
SqlCommand1.Parameters("@city").Value = txtCity.Text
SqlCommand1.Parameters("@state").Value = ddlState.SelectedItem.Text
SqlCommand1.Parameters("@zip").Value = txtZip.Text
SqlCommand1.Parameters("@email").Value = txtEmail.Text
SqlCommand1.Parameters("@phone").Value = txtPhone.Text
SqlCommand1.Parameters("@item1").Value = ddlGift1.SelectedItem.Text
SqlCommand1.Parameters("@item2").Value = ddlGift2.SelectedItem.Text
SqlCommand1.Parameters("@item3").Value = ddlGift3.SelectedItem.Text
SqlCommand1.Parameters("@comments").Value = txtComments.Text
SqlConnection1.Open()
SqlCommand1.ExecuteNonQuery()
SqlConnection1.Close()
Response.Redirect("Success.aspx")
End If
End Sub
End ClassMy stored procedure looks like this:CREATE PROCEDURE dbo.InsertFreeOrders  (  @firstname varchar( 50 ),  @lastname varchar( 50 ),  @address1 varchar( 100 ),  @address2 varchar( 100 ),  @city varchar( 50 ),  @state varchar( 50 ),  @zip numeric,  @email varchar( 50 ),  @phone varchar( 50 ),  @item1 varchar( 50 ),  @item2 varchar( 50 ),  @item3 varchar( 50 ),  @comments text  )ASInsert FreeOrders ( o_first_name, o_last_name, o_address_1, o_address_2, o_city, o_state, o_zip, o_email, o_phone, o_item_1, o_item_2, o_item_3, o_comments ) Values ( @firstname, @lastname, @address1, @address2, @city, @state, @zip, @email, @phone, @item1, @item2, @item3, @comments )GOSo it is working, just not completely and I am stumped here.  Any help would be great!  Thanks.

View 6 Replies View Related

Passing Date Fields From Form To Access ADP Views

Jul 20, 2005

I have a whole bunch of forms that have an unbound StartDate and anEndDate field that I have used in MSAccess MDB databases as parametersin queries (ie tblEvent.StartDate > Forms!myFormName.StartDate.)So, now I'm migrating this beast over to and ADP/SQL Server projectusing Views and Procedures.How do I pass the value in Forms!myFormName.StartDate to a Procedureand get something that looks like:If tblEvent.StartDate > Forms!myFormName.StartDate then ...Any help is GREATLY appreciated. This is a major problem before I canmove ahead with this beast!lq

View 1 Replies View Related

Insert Query Fails (if Form Fields Left Empty)

Aug 13, 2007

Dear All,
I have created a table in my SQL server database, the problem i am facing is my insert query fails if i leave any form field empty (leave it blank). On my back-end table, only one field is mandatory, and others have been set with the constraint "allow null".
As per our business requirement, except one value is complusory while others are optional. If I enter all values in the form it works perfectly fine. Can you see in the code below - where am i possibly going wrong ?
<script language="VB" runat="server" >      Sub Page_Load(Src As Object, e As EventArgs)                      If Page.IsPostBack Then                        Dim ConLath As SqlConnection            Dim comLath As SqlCommand            Dim insertcmd                        conLath = New SqlConnection("Data Source=SQLas;Initial Catalog=settle;User ID=sa;Password=password")            ConLath.Open()            insertcmd = "Insert into His_set values (@t_d,@s_p,@p_s,@v_oq,@i_oq,@v_qn,@i_qn,@v_qw,@i_qw)"                        comLath = New SqlCommand(insertcmd, ConLath)                                    comLath.Parameters.Add(New SqlParameter("@t_d", SqlDbType.DateTime, 12))            comLath.Parameters("@t_d").Value = trade_date.Text            comLath.Parameters.Add(New SqlParameter("@s_p", SqlDbType.Decimal, 8))            comLath.Parameters("@s_p").Value = sett_price.Text            comLath.Parameters.Add(New SqlParameter("@p_s", SqlDbType.Decimal, 8))            comLath.Parameters("@p_s").Value = post_close.Text            comLath.Parameters.Add(New SqlParameter("@v_oq", SqlDbType.Int, 8))            comLath.Parameters("@v_oq").Value = vol_oq.Text            comLath.Parameters.Add(New SqlParameter("@i_oq", SqlDbType.Int, 8))            comLath.Parameters("@i_oq").Value = oi_oq.Text            comLath.Parameters.Add(New SqlParameter("@v_qn", SqlDbType.Int, 8))            comLath.Parameters("@v_qn").Value = vol_qn.Text            comLath.Parameters.Add(New SqlParameter("@v_qw", SqlDbType.Int, 8))            comLath.Parameters("@v_qw").Value = vol_qw.Text            comLath.Parameters.Add(New SqlParameter("@i_qn", SqlDbType.Int, 8))            comLath.Parameters("@i_qn").Value = oi_qn.Text            comLath.Parameters.Add(New SqlParameter("@i_qw", SqlDbType.Int, 8))            comLath.Parameters("@i_qw").Value = oi_qw.Text
                        Try                comLath.ExecuteNonQuery()                            Catch ex As SqlException                If ex.Number = 2627 Then                    Message.InnerHtml = "ERROR: A record already exists with " _                       & "the same primary key"                Else                    Message.InnerHtml = "ERROR: Could not add record, please " _                       & "ensure the fields are correctly filled out"                    Message.Style("color") = "red"                End If            End Try
            comLath.Dispose()            ConLath.Close()                                                        End If   End Sub
</script>
 

View 6 Replies View Related

Contact Form - Variable Number Of Input Fields, Store Data As Xml String ?

Jul 13, 2007

Im trying to determine the best way to store data gathered from a form that a user will fill out online.  The form is dynamic and is customized at run time based on group-specific criteria.  The end result is a form that might have 3 extra text boxes, 2 extra sets of radio buttons and a freeform textbox, whereas for another group, there might be a slightly different set of input fields.   Now comes the issue of storing this data.  Since the fields can be somewhat dynamic, it could get tricky to define table columns for each possible input field.  So Im considering storing the data as xml.  Has anyone else had to build custom forms and ended up storing the data as xml ?

View 2 Replies View Related

One Form To Update Different SQL Tables Based Upon Form Selection

Apr 16, 2008

Hello,
My company Intranet has a form that agents can use to post their comments about the company to upper management, but our customer service department would like to modify the form so that the agent has to pick from a comment type.
The dropdown options on the form will be as follows:
ComplimentsComplaintsGeneral CommentsSuggestions
Each dropdown option has a designated table in a SQL DB.Using postback on the same page, I need to change which fields of the form are visible based upon which dropdown selection the user chooses, and I need the fields to then be inserted into the table that corresponds with the dropdown selection item.
For example: If the Compliments dropdown selection is picked, I need a text box to show for the user's location, the name of the customer, account number, and the message box. Once the submit button is clicked, the characters in these boxes need to be inserted into the Compliments table using its data adapter.
However, if the user selects Suggestions, the name of the customer and the account number should not be visible, since these fields do not exist and when the submit button is pressed, the Suggestions table should be updated.
If you need more information, I will provide whatever is needed.
As always, thanks for everyone's assistance.
Chris

View 3 Replies View Related

How To Make The SSMSE To Return Whole Records Without Any Close Query Form And Re-create Query Form Operation?

Dec 25, 2007

Hi,
I got a problem.
I installed Microsoft SQL Server Management Studio Express 2005 version.
And I created a Compact database.
I created an connection in SSMSE to connect the database and opened a query form.
then, i run the following sql:

Select * from Table1

It returned 3 records to me.
After that, I used program to insert record into this table.
Then i ran this sql again, it still show me 3 records.
I closed the query form, and re-created a new query form, then run the sql, it returned 4 records to me.

Why? It's very strange and difficult to operate, right?
Is there anyone know how to make the SSMSE to return whole records without any close query form and re-create query form operation?

Thanks a lot!

And Merry X'max!!!

View 4 Replies View Related

First Form Normalizations And Second Form Normalization

Jul 19, 2006

Hi everyone,
What is the main difference between first form normalizations and second form normalization ?
In my opinion, they are both generated for the same operation which is to prevent redundancy(in other words; duplication of data in several records).
So would you please explain it to me ?

Thanks

View 1 Replies View Related

How Do I Bring In A Date Which Is In Integar Form Into A Databse As A Date Form.

Jul 23, 2005

HiI have a Platinum database which stores dates in integer form e.g the dateis formatted as below:Column_name Type Length Precision------------------------------ ------------------------------from_date int 4 10Some of the dates in the Platinum database are as follows:729115729359730059730241730302730455How can I bring them into SQL 2000 as valid dates.Thanks for your assistanceSam CJoin Bytes!

View 1 Replies View Related

Subreports: Parameter Value Dropdown Shows Sum And Count Fields But Not The Actual Data Fields.

Jan 28, 2008


I have just started using SQL Server reporting services and am stuck with creating subreports.

I have a added a sub report to the main report. When I right click on the sub report, go to properties -> Parameters, and click on the dropdown for Parameter Value, I see all Sum and Count fields but not the data fields.

For example, In the dropdownlist for the Parameter value, I see Sum(Fields!TASK_ID.Value, "AppTest"), Count(Fields!TASK_NAME.Value, "CammpTest") but not Fields!TASK_NAME.Value, Fields!TASK_ID.Value which are the fields retrieved from the dataset assigned to the subreport.

When I manually change the parameter value to Fields!TASK_ID.Value, and try to preview the report, I get Error: Subreport could not be shown. I have no idea what the underlying issue is but am guessing that it's because the field - Fields!TASK_ID.Value is not in the dropdown but am trying to link the main report and sub report with this field.

Am I missing something here? Any help is appreciated.

Thanks,
Sirisha

View 3 Replies View Related

Creating A Table In SQL Server With Fields From Other Tables And Some Fields User Defined

Feb 20, 2008

How can I create a Table whose one field will be 'tableid INT IDENTITY(1,1)' and other fields will be the fields from the table "ashu".
can this be possible in SQL Server without explicitly writing the"ashu" table's fields name.

View 8 Replies View Related

Public Overridable ReadOnly Default Property Fields() As ADODB.Fields

Jan 26, 2008

sir

I have got this error message to establish connction with recordset vb .net, Can you please rectify this

Too many arguments to 'Public Overridable ReadOnly Default Property Fields() As ADODB.Fields'

my code like this


rs = New ADODB.Recordset

rs.Open("Select * from UserLogin where userid='" & txtUserName.Text & "'", gstrDB, DB.CursorTypeEnum.adOpenStatic)


If txtUserName.Text = rs.Fields.Append(userid) Then


MsgBox("OK", MsgBoxStyle.OKOnly, "Confirmation")

End If


thanks

View 1 Replies View Related

Update Fields With Searched First Date Record Fields

Jul 23, 2005

Hello !I'm trying to update one table field with another table searched firstdate record.getting some problem.If anyone have experience similar thing or have any idea about it,please guide.Sample case is given below.Thanks in adv.T.S.Negi--Sample caseDROP TABLE TEST1DROP TABLE TEST2CREATE TABLE TEST1(CUST_CD VARCHAR(10),BOOKING_DATE DATETIME,BOOKPHONE_NO VARCHAR(10))CREATE TABLE TEST2(CUST_CD VARCHAR(10),ENTRY_DATE DATETIME,FIRSTPHONE_NO VARCHAR(10))DELETE FROM TEST1INSERT INTO TEST1 VALUES('C1',GETDATE()+5,'11111111')INSERT INTO TEST1 VALUES('C1',GETDATE()+10,'22222222')INSERT INTO TEST1 VALUES('C1',GETDATE()+15,'44444444')INSERT INTO TEST1 VALUES('C1',GETDATE()+16,'33333333')DELETE FROM TEST2INSERT INTO TEST2 VALUES('C1',GETDATE(),'')INSERT INTO TEST2 VALUES('C1',GETDATE()+2,'')INSERT INTO TEST2 VALUES('C1',GETDATE()+11,'')INSERT INTO TEST2 VALUES('C1',GETDATE()+12,'')--SELECT * FROM TEST1--SELECT * FROM TEST2/*Sample dataTEST1CUST_CD BOOKING_DATE BOOKPHONE_NOC12005-04-08 21:46:47.78011111111C12005-04-13 21:46:47.78022222222C12005-04-18 21:46:47.78044444444C12005-04-19 21:46:47.78033333333TEST2CUST_CD ENTRY_DATE FIRSTPHONE_NOC12005-04-03 21:46:47.800C12005-04-05 21:46:47.800C12005-04-14 21:46:47.800C12005-04-15 21:46:47.800DESIRED RESULTCUST_CD ENTRY_DATE FIRSTPHONE_NOC12005-04-03 21:46:47.80011111111C12005-04-05 21:46:47.80011111111C12005-04-14 21:46:47.80044444444C12005-04-15 21:46:47.80044444444*/

View 3 Replies View Related

Transact SQL :: Get One Row From Multiple Based On Fields And Also Get Sum Of Decimal Fields?

Jul 2, 2015

I am using MS SQL 2012.  I have a table that contains all the data that I need, but I need to summarize the data and also add up decimal fields while at it.  Then I need a total of those added decimal fields. My data is like this:

I have Providers, a unique ID that Providers will have multiples of, and then decimal fields. Here are my fields:

ID, provider_name, uniq_id, total_spent, total_earned

Here is sample data:

1, Harbor, A07B8, 500.00, 1200.00
2, Harbor, A07B8, 400.00, 800.00
3, Harbor, B01C8, 600.00, 700.00
4, Harbor, B01C8, 300.00, 1100,00
5, LifeLine, L01D8, 700.00, 1300.00
6, LifeLine, L01D8, 200.00, 800.00

I need the results to be just 3 lines:

Harbor, A07B8, 900.00, 2000.00
Harbor, B01C8, 900.00, 1800.00
LifeLine, L01D8, 900.00, 2100.00

But then I would need the totals for the Provider, so:

Harbor, 1800.00, 3800.00

View 3 Replies View Related

Search Multipe Fields, Compounding Fields, Like, Contains...?

Jul 20, 2005

I would like to search a table for a phrase, or for a partial phrase,eg on table product - for name or description, or name + descprition.How does one say select * from product where name + description like%phrase%or contains phraseCurrently I can get where name, or where descriotion like %phrase%,eg, where name like krups, or where description like coffee makerBut if I search for where name like %krups coffee maker% i get noresults. krups is in the name field, coffee maker is in thedescription field.Thanks,-M

View 1 Replies View Related

Update Fields With Data From Other Fields In Same Row

Jun 30, 2000

Pardon me if this question is too elementary. I am trying to create a trigger that will cause certain datafields to be updated with values from other data fields in the same row when a certain column, created specifically to fire the trigger, is updated. The purpose of this is to reduce data entry by field personnel.I think I have the create trigger statement correct, but I'm a little confused on the update statement.

In a nutshell, how can I write something like:
UPDATE "TABLENAME"
SET DATAFIELD1 = DATAFIELD2
WHERE RECORDNUMBER = (THE SAME RECORD NUMBER)

I do know that I have to ensure that sp_dboption Recursive Triggers value is set to false, thanks.

View 2 Replies View Related

Using LIKE To Find Any Of Fields In One Table In Fields Of Another

Jul 31, 2013

I have a list of items in one table and a field (pageName) in another table that may contain one of the aforementioned items somewhere within that field. There is no fixed position within the field where the itemNo may be so I can't just use SUBSTRING(pageName,2,5) in(select itemNo from tblItem).

Logically, it's like I need to combine IN and LIKE: select pageName where pageName LIKE IN %select itemNo from tblitemNo%..LIKE can only handle one comparison string.

View 5 Replies View Related

Drillthrough In Calculated Fields Enable When Drillthrough Option Is Disable In Original Fields, Is This A BUG?

Jan 21, 2008

Hi people
My users are having troubles with link to default drillthrough report when reports are exported to excel (they REALLY don't like this behavior ), so I decided set all of them disabled in report model, this work fine, but calculated field in reports has this drillthrough link.


Let me show you the situation. Entity Product has an UnitaryCost field, I set the EnableDrillthrough Property in False so when I export a report with this field, no link is shown.

But if I create in the report a calculated field Round(UnitaryCost) this field has a Drillthrough Link

Is this the standard and expected behavior? or its simply a BUG?

Have I done something wrong in my model? and in this case, How I can correct this?

regards.
Julio Diaz.

View 1 Replies View Related

Getting Out Of Form

Jul 11, 2007

I am trying to add records to SQL database, thru <form> </form> on click of button, The system is working fine, Databse table is getting updated correctly.
But screen displays the same form again while i want it to open another asp.net page i.e. buy.aspx and also generate an e-mail automatically.
I m stuck. Please help.
 pcg
 
Relevent code of mine is as below.
<script runat="server">
    void addtosalelist(Object sender, EventArgs e)    { .... .... dbConnection.Open(); .... ....        dbConnection.Close();     }
 
<form action="buy.aspx" method="post" runat="server">.........<asp:Button id="button1" onclick="addtosalelist" runat="server" Text="Submit"></asp:Button>                                    </form>

View 5 Replies View Related

Help Me Form This SQL?

Mar 2, 2006

Hi all, this'll be my first post here, hopefully I'll get this right and someone can help.

I'm trying to generate a subquery that will take a set of one-column rows and concatenate them into a single cell.

I've adapted from this article (http://www.sqlteam.com/item.asp?ItemID=2368) the following code:
DECLARE @topicList varchar(200)

SELECT @topicList = COALESCE(@topicList + ', ', '') + MAB_topics.topic_name
FROM MAB_topics

SELECT @topicList
that produces a list of all the topic_names in the database seperated by commas. That's fine.

I couldn't follow all the code in this thread (http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=18363) but I was able to extract and modify this code:

DECLARE @topicList varchar(200)

SELECT MAB_topics.topic_name
INTO #tmp
FROM MAB_topics, MAB_articleIndex
WHERE MAB_articleIndex.article_ID = 76 AND
MAB_topics.topic_ID = MAB_articleIndex.topic_ID

SELECT * FROM #tmp

drop table #tmp
which returns the two topic_names that I'd expect. (Note: this is my very first day declaring variables and using temp tables.) So I keep thinking that the following code would combine the two above working functions. But, when I run it in Query Analyzer, it just returns "(2 row(s) affected)" instead of a recordset.

DECLARE @topicList varchar(200)

SELECT MAB_topics.topic_name
INTO #tmp
FROM MAB_topics, MAB_articleIndex
WHERE MAB_articleIndex.article_ID = 76 AND
MAB_topics.topic_ID = MAB_articleIndex.topic_ID

SELECT @topicList = COALESCE(@topicList + ', ', '') + #tmp.topic_name
FROM #tmp

drop table #tmp
What am I doing wrong? I'm sure it's something simple but I've been reading and trying and reading and trying for a few hours and haven't gotten it yet. The ideal response would figure out what I'm trying to do as well as what my mistake is and explain how I'm misthinking. A close second would be just fixing my code. :)

Thanks in advance,

Chris

View 6 Replies View Related

How To Add Data To SQL Via Web Form?

Feb 19, 2008

HiI am using Visual Web Developer 2005 Express and SQL Server Express 2005.From Northwind I can display data to Gridview.Could someone point me in the right direction on two points.How do I start a new database (.mdf) - I cannot find this option.I can change Northwind around - but I want to start my own database.
Once I have that sorted - how can I "insert" data into database using a dropdown box?A "dropdown" box such as you would find online.
Thanks in advance.Stephen

View 2 Replies View Related

Web Form Button ?

Sep 24, 2004

I need to make a query to a SQLserver db passing values from a dropdownlist and two text boxes as my criteria. Now if nothing is selected and the button is pressed, I would like to return everything that is part of my Select statement. I am having trouble making my sql statement work.

Im sending you my code as an attachment. I've put * around the area i really need help with.

Even if you could just point me in the right direction as to where to look for a good web forms book using VB.NET and ASP.NET I would really appreciate it.

Thanks,

Jose
AIM- RangerBud249
Yahoo- RangerBud249


Imports System.Data.OLEDB
Imports System.Data
Imports System.Data.SqlClient
Public Class Test
Inherits System.Web.UI.Page
Public dbConn As SqlConnection
Public da As SqlDataAdapter
Protected WithEvents txtStart As System.Web.UI.WebControls.TextBox
Protected WithEvents txtEnd As System.Web.UI.WebControls.TextBox
Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents img_cal1 As System.Web.UI.WebControls.ImageButton
Protected WithEvents img_cal2 As System.Web.UI.WebControls.ImageButton
Public ds As DataSet

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'the TailNumber is the first thing that will load
If Not Page.IsPostBack Then
lstAircraft.DataSource = GetAircraft() 'this function will load the Tail Numbers
lstAircraft.DataValueField = "TailNumber"
lstAircraft.DataTextField = "TailNumber"
lstAircraft.DataBind()
End If
End Sub

Function GetAircraft() As System.Data.DataSet
'this function will load the Tail Numbers
Dim connectionString As String = "connection info"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT [Aircraft].[TailNumber] FROM [Aircraft]"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function

******************************************************************************************************************
this is the area I really need help with

Sub btm_Submit_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim connectionString As String = "connection info"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
dbConnection.Open()
dbConnection.Close()
Dim selection As String
Dim startTime As String
Dim landingTime As String
Dim flights As String

Dim selString As String = "SSELECT AircraftID, fromLocation, startTime, toLocation, landingTime, ID, Filename, VSU, local_1 FROM Flights, tbl_FileNames, tbl_VSU"

Dim commandString As String = "SELECT [Flights].AircraftID, [Flights].fromLocation, [Flights].startTime, [Flights].toLocation, [Flights].landingTime, [tbl_FileNames].ID, [tbl_FileNames].Filename, [tbl_FileNames].VSU, [tbl_FileNames].local_1 FROM Flights, tbl_FileNames, tbl_VSU"

selection = "where " & Me.lstAircraft.SelectedValue.ToString & " " & startTime = Me.txtStart.Text & " " & Me.txtEnd.Text = landingTime & " " & [Flights].[ID] = [tbl_VSU].[flight_id]) AND [tbl_VSU].[filename_id] = [tbl_FileNames].[ID]"
If Me.txtStart.Text <> "" Then
selString = selString & selection
End If
Session("SelStr") = selString

Dim dbCommand As New OleDbCommand(commandString, dbConnection)

DataGrid1.DataSource = GetFlights(lstAircraft.SelectedValue)
DataGrid1.DataBind()
End Sub
*********************************************************************************************************************

Function GetFlights(ByVal ID As Integer) As System.Data.DataSet
Dim connectionString As String = "connection info"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT [Flights].[toLocation], [Flights].[startTime], [tbl_FileNames].[ID], [Flig" & _
"hts].[fromLocation], [tbl_FileNames].[filename], [tbl_FileNames].[Local_1], [Fli" & _
"ghts].[AircraftID], [Flights].[landingTime], [tbl_FileNames].[VSU] FROM [Flights" & _
"], [tbl_FileNames], [tbl_VSU] WHERE (([Flights].[ID] = [tbl_VSU].[flight_id]) AN" & _
"D ([tbl_VSU].[filename_id] = [tbl_FileNames].[ID]))"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function

Private Sub img_cal1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles img_cal1.Click
'this will make the calendar for start visible when clicked and not visible if clicked again
Session("Cal1") = True
Session("Cal2") = False
Me.Calendar1.Visible = True
End Sub


Private Sub img_cal2_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles img_cal2.Click
'this will make the calendar for end visible when clicked and not visible if clicked again
Session("Cal2") = True
Session("Cal1") = False
Me.Calendar1.Visible = True

End Sub

Private Sub Calendar1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
'this will put the date selected in my text box as a short date
If Session("Cal1") = True Then
txtStart.Text = Calendar1.SelectedDate.ToShortDateString
Session("Cal1") = False
ElseIf Session("Cal2") = True Then
txtEnd.Text = Calendar1.SelectedDate.ToShortDateString
Session("Cal2") = False
End If
Me.Calendar1.Visible = False

End Sub


End Class

View 1 Replies View Related

How To Add SQL Clock In VB Form

Jun 25, 2005

HI I just signed up this forum,I wanted some help.How can i add sql clock on VB Form.
Arshad

View 2 Replies View Related

Form Problems

Jun 10, 2004

Can anyone help me with this problem? I have a form with three drop down lists. From these lists, the user selects an accountID, the territory that ID is from, and the territory that ID is transfering to. Upon submission, that account number is inserted into the table, along with the TerritoryID, RegionID, DivisionID, and EmpID associated with both of the territories selected. However, upon running this, the accountID and ToTerritory info are inserted once, but the FromTerritory data is inserted tens of thousands of times. Although they are not entered into the same record, which i eventually want to happen, i do want to figure out why so many duplicate entries for the FromTerritory are entered. Here is my code and the stored procedure to enter the FromTerritory. I would appreciate any help.
-------------------------

Sub InsertData()



Dim sql as string

dim sql1 = "insertaccounttransfermike 'AccountID''" & AccNumber.SelectedItem.Value & "'"
dim sql2 = "insertaccounttransfermikefrom 'FromTerritory''" & FromName.SelectedItem.Value & "'"
dim sql3 = "insertaccounttransfermiketo 'ToTerritory''" & ToName.SelectedItem.Value & "'"

' Create Connection Object, Command Object, Connect to the database
Dim conn as New SQLConnection(connstr)

Dim cmd1 as New SQLCommand(sql1,conn)
Dim cmd2 as New SQLCommand(sql2,conn)
Dim cmd3 as New SQLCommand(sql3,conn)

conn.open()
cmd1.ExecuteNonQuery()
cmd2.ExecuteNonQuery()
cmd3.ExecuteNonQuery()
conn.Close()

' go to the datagrid query page
Response.redirect(return_page)

end sub

--------------------------
CREATE PROCEDURE InsertAccountTransferMikefrom

@FromTerritory nvarchar(50)

AS

Insert INTO AccountTransfersTestMike

(FromTerritoryID, FromRegionID, FromDivisionID, FromEmpID)

SELECT Territories.TerritoryID, Regions.RegionID, Divisions.DivisionID, Employees.EmployeeID
FROM EndoscopySqlUser.Territories INNER JOIN
EndoscopySqlUser.Regions ON EndoscopySqlUser.Territories.RegionName = EndoscopySqlUser.Regions.Region INNER JOIN
EndoscopySqlUser.Employees ON EndoscopySqlUser.Territories.TerritoryID = EndoscopySqlUser.Employees.TerritoryID INNER JOIN
EndoscopySqlUser.Divisions ON EndoscopySqlUser.Regions.Division = EndoscopySqlUser.Divisions.DivisionID, accounts
WHERE ( (EndoscopySqlUser.Employees.DateLeft IS NULL) AND (EndoscopySqlUser.Territories.TerritoryName=@FromT erritory))
GO

View 1 Replies View Related

How To Form Query?

Jul 24, 2004

i am using this statement

select dateadd(dd,1,20010331)


and it's throwing an error

Arithmetic overflow error converting expression to data type datetime.

what's wrong?

View 2 Replies View Related

How To Form The Query

Apr 5, 2008

I have two tables. The table is below.

Table name 1 : Income
Income RentMonth
1500 Jan
1500 Feb
1500 Apr

Table name 2 : Expense
Expense ExpMonth
200 Jan
300 Mar
400 Apr

The result table becomes (Profit=Income-Expense)
Profit Month
1300 Jan
1500 Feb
-300 Mar
1100 Apr

But I form the query by join the both Income and Expense tables to subtract the Income and Expense month wise.

But one moth is in one table the same month is not in another table.

For Example Feb month is in Income table, but not in Expense table.And Mar month is in Expense table and not in Income table. So how will I form the query to achieve my result table as i indicated above. Kindly help me.

Kamal.

View 2 Replies View Related

Please Help! ASP Form To SQL Database

Apr 25, 2008

I'm using SQL server on godaddy.com, and for the life of me, tried all freakin day yesterday to get a form to send data to my table, and can't get it to work for the life of me

I think the asp form sends the information to the asp page that is to add the information to the tables correctly, but am not entirely sure, so here is the code for the form:

<html>
<head>
<title>Form Entry</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body><form method="post" action="add.asp">
<table>
<tr>
<td>CustomerID:</td>
<td><input name="CustID"></td>
</tr><tr>
<td>Company Name:</td>
<td><input name="Company"></td>
</tr><tr>
<td>Contact Name:</td>
<td><input name="Contact"></td>
</tr><tr>
<td>Address1:</td>
<td><input name="Address1"></td>
</tr><tr>
<td>Address2:</td>
<td><input name="Address2"></td>
</tr><tr>
<td>Address3:</td>
<td><input name="Address3"></td>
</tr><tr>
<td>City:</td>
<td><input name="City"></td>
</tr><tr>
<td>State:</td>
<td><input name="State"></td>
</tr><tr>
<td>Zip:</td>
<td><input name="Zip"></td>
</tr>
<td>Email:</td>
<td><input name="Email"></td>
</tr><tr>
<td>Phone:</td>
<td><input name="Phone"></td>
</tr>
</table>
<br /><br />
<input type="submit" value="Add New">
<input type="reset" value="Cancel">
</form>
</body>
</html>


Now for the page that is giving me the problem (I think). I'm pretty sure I'm fudging up the connectivity somewhere because all I get is an http 500 error every time I try to upload the information.

Why won't it bloody connect?!?!

Also, is the DIM function on this page used to hide important information? If you guys can help me fix this, I'd be incredibly, incredibly greatful, I'm frustrated out of my mind!

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="CP_ACP"%>
<html>
<head>
<title>piece of shit page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server

db_server = "whsql-v22.prod.mesa1.secureserver.net"
db_name = "Fulfillment"
db_username = "Fulfillment"
db_userpassword = "your_password"
tablename = "KSEP_Customers"

connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"sql="INSERT INTO customers (CustID,companyname,"
sql=sql & "contactname,address,city,postalcode,country)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("CustID") & "',"
sql=sql & "'" & Request.Form("Company") & "',"
sql=sql & "'" & Request.Form("Contact") & "',"
sql=sql & "'" & Request.Form("Address1") & "',"
sql=sql & "'" & Request.Form("Address2") & "',"
sql=sql & "'" & Request.Form("Address3") & "',"
sql=sql & "'" & Request.Form("City") & "',"
sql=sql & "'" & Request.Form("State") & "',"
sql=sql & "'" & Request.Form("Zip") & "',"
sql=sql & "'" & Request.Form("Email") & "',"
sql=sql & "'" & Request.Form("Phone") & "')"on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write("No update permissions!")
else
Response.Write("<h3>" & recaffected & " record added</h3>")
end if
conn.close
%>

</body>
</html>

View 4 Replies View Related

Login Form Gets Ignored

Jun 8, 2006

I have a Visual Basic application that connects to a SQL server database. In my application, I have a login screen that is supposed to pause the application (it's coded as modal) and ask the user for a login and password. I have my connection string and user set up to use Windows NT authentication.

However, what is happening with my application is that as soon as I start the program, it never stops at the login screen, but instead goes right into the application.

Is this "normal" when using Windows NT authentication? What causes this behavior? How can I make my program stop at the login screen, and more interestingly, would I want to stop at a login screen?

Thanks in advance to all who reply. This is driving my crazy!

This forum is best viewed with a computer. Questions asked freely. Confusion happily shared.

View 2 Replies View Related

How Output On A Form?

Oct 10, 2006

Vuyo writes "how do you output values from the database to a form(.NET Platform)?"

View 2 Replies View Related

How To Form This Query

Jan 14, 2007

I have a table SIM_Temp where I ahve three fields val1,val2,val3. I have some data like

SIM_Temp
--------


Val1----------Val2-------------Val3
===================================



AIRMECH------172371.13---------2004
AIRMECH------4269.5------------2003
ETA----------2871704.6724------2005
ETA----------6244149.0769------2004
ETA----------9046873.6504------2003


What I want is, I want this to be read like

CustomerName 2003------------2004----------2005

AIRMECH------------4269.5---------172371.13-----Nil
ETA--------------9046873.6504-----6244149.0769--9046873.6504


Please advice me, how could I do this.

Thank you
Ceema

View 7 Replies View Related

How To Form This Query

Jan 17, 2007

I have a table SIM_TempCustomer where I have 5 fileds nad Values Like


SIM_TempCustomer
----------------

Val1.........Val2.........Val3.........Val4.........Val5
---------------------------------------------------------
A.............NUll........1.............Null.........3
B.............Null........Null..........Null.........2
C.............Null........6.............12...........Null


What I want i, if there is any value in any fields, other null values
in the field should be replaced by 0, if all the rows of the filed
are null, simply leave as it is....


Like the select statement of this SIM_TempCustomer should give a result like


Val1.........Val2.........Val3.........Val4.........Val5
---------------------------------------------------------
A.............NUll........1.............0............3
B.............Null........0.............0............2
C.............Null........6.............12...........0


Could any one help me.

Thanks
Ceema

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved