Query In Dataview/update Form

Dec 23, 2006

Question related to Visual Basic Video Lesson 09 (Databinding.wmv) by Bob Tabor.

Made a table and a UI form according to this lesson (table colums: CustomerID, FirstName, LastName).

Is it possible to use the same or an identical looking query form to find "Bob" by typing Bob in the Fist Name textbox or "Tabor" by typing Tabor in the Last Name textbox as in FileMaker?

Thanks,

View 4 Replies


ADVERTISEMENT

Bulk Update Of All Changes From DataView To DataSet (only Opening Connection Once)?

Feb 15, 2008

(Hope this isn't a "stupid" question, but I haven't been able to find a straight-forward answer anywhere)"
I currently have code that iterates through a dataview's records, making a change to a field in some of the records. The way I have this coded, a conection has to opened & closed for each individual record that's updated:
    dsrcUserIae.UpdateCommand = "UPDATE UserIAE SET blnCorrect = @blnCorrect WHERE (ID = @ID)"    dsrcUserIae.UpdateParameters.Add("blnCorrect", SqlDbType.Bit)    dsrcUserIae.UpdateParameters.Add("ID", SqlDbType.Int)
    Dim myDataView As DataView = CType(dsrcUserIae.Select(DataSourceSelectArguments.Empty), DataView)         For Each myRow As DataRowView In myDataView       If myRow("FkUsersAnswerID") = myRow("AnswerID") Then         intCorrect = 1       Else         intCorrect = 0       End If       dsrcUserIae.UpdateParameters.Item("blnCorrect").DefaultValue = intCorrect       dsrcUserIae.UpdateParameters.Item("ID").DefaultValue = myRow("ID")       intUpdateResult = dsrcUserIae.Update()    Next
It seems like I should be able to do something like this (call update once), but I'm not sure how... 
    dsrcUserIae.UpdateCommand = "UPDATE UserIAE SET blnCorrect = @blnCorrect WHERE (ID = @ID)"    dsrcUserIae.UpdateParameters.Add("blnCorrect", SqlDbType.Bit)    dsrcUserIae.UpdateParameters.Add("ID", SqlDbType.Int)
    Dim myDataView As DataView = CType(dsrcUserIae.Select(DataSourceSelectArguments.Empty), DataView)            For Each myRow As DataRowView In myDataView      If myRow("FkUsersAnswerID") = myRow("AnswerID") Then        myRow("blnCorrect") = 1      Else        myRow("blnCorrect") = False      End If    Next
      intUpdateResult = dsrcUserIae.Update() 'Want all changed myRow("blnCorrect") to be updated to datasource
Can anybody explain how to do the bulk update? I've seen some info about AcceptChanges and Merge, but I'm not sure if they apply here, or if they more for Transactions.

View 1 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

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

Query In Dataview.rowfilter

Jul 23, 2005

In the dataview rowfilter property, how can I say that I just wantTitles that start with 'A' to 'J' ??ex:dv.rowfilter = " Country = ' France ' "I wantdv.rowfilter = " Title = (from 'A' to 'J') "This doesn't work :dv.rowfilter = " Title like '[a-j]%' "Neither does :dv.rowfilter = " Title like 'a%'" AND "Title like 'b%'" AND..so onBut this does work just for the Titles starting with 'a'dv.rowfilter = " Title like 'a%' "any idea ?JMT

View 2 Replies View Related

Update Web Form

Dec 29, 2005

I'm trying to create a online update form to a SQL table. I've neverdone this function before, and I'm not quite sure I have the codingcorrect. Below is the coding for the Update statement.final String udc = "UPDATE INTO " + "Comm_WebSubmission Set ProjectID= request.getParameter("ProjectID")(Assigned,DateAssigned,Status,StatusDescription,Re solution,CompletionDate)values(?,?,?,?,?,?)";Any help you can give me would be greatly appreciated.Cat

View 1 Replies View Related

Form Update Problem

Jan 8, 2008

I'm very new to asp.net and c#, I have been thrown in the deep end with a project at work and I'm really struggling to overcome this problem so any help will be very greatly appreciated.  I have a form with a number of textboxes that users use to update records in a database table with the use of a stored procedure.  The problem is that I can't get the form to just update the boxes that a user has filled out.  The form is working at the moment only if the user fills out all the boxes on the form which obviously is a waste of time if they only want to update one field.  I have tested the stored procedure and it works fine.  Please find the below code I'm trying to use!
 1 protected void Targets_Insert(object sender, EventArgs e)
2 {
3 System.Data.SqlClient.SqlConnection objConn = new System.Data.SqlClient.SqlConnection();
4 objConn.ConnectionString = "Data Source=SQL1;Password=rdbx;User ID=rdbx;Initial Catalog=Pronet";
5 objConn.Open();
6 System.Data.SqlClient.SqlCommand objCmd = new System.Data.SqlClient.SqlCommand("Update_Targets", objConn);
7 objCmd.CommandType = System.Data.CommandType.StoredProcedure;
8
9 System.Data.SqlClient.SqlParameter pdate = objCmd.Parameters.Add("@date", System.Data.SqlDbType.DateTime);
10 System.Data.SqlClient.SqlParameter pcontacts_new = objCmd.Parameters.Add("@contacts_new", System.Data.SqlDbType.Int);
11 System.Data.SqlClient.SqlParameter papplicants_new = objCmd.Parameters.Add("@applicants_new", System.Data.SqlDbType.Int);
12 System.Data.SqlClient.SqlParameter pclients_new = objCmd.Parameters.Add("@clients_new", System.Data.SqlDbType.Int);
13 System.Data.SqlClient.SqlParameter pHeadhunts_new = objCmd.Parameters.Add("@headhunts_new", System.Data.SqlDbType.Int);
14 System.Data.SqlClient.SqlParameter pCanvass_Calls_new = objCmd.Parameters.Add("@canvass_Calls_new", System.Data.SqlDbType.Int);
15 System.Data.SqlClient.SqlParameter pRegens_new = objCmd.Parameters.Add("@regens_new", System.Data.SqlDbType.Int);
16 System.Data.SqlClient.SqlParameter pJobs_Added_new = objCmd.Parameters.Add("@jobs_added_new", System.Data.SqlDbType.Int);
17 System.Data.SqlClient.SqlParameter pCVS_sent_new = objCmd.Parameters.Add("@CVS_sent_new", System.Data.SqlDbType.Int);
18 System.Data.SqlClient.SqlParameter puserid = objCmd.Parameters.Add("@userid", System.Data.SqlDbType.Int);
19 System.Data.SqlClient.SqlParameter punique_applicants_sent_new= objCmd.Parameters.Add("@unique_applicants_sent_new", System.Data.SqlDbType.Int);
20 System.Data.SqlClient.SqlParameter paverage_rate_new = objCmd.Parameters.Add("@average_rate_new", System.Data.SqlDbType.Int);
21 System.Data.SqlClient.SqlParameter paverage_salary_new = objCmd.Parameters.Add("@average_salary_new", System.Data.SqlDbType.Int);
22 System.Data.SqlClient.SqlParameter paverage_fee_new = objCmd.Parameters.Add("@average_fee_new", System.Data.SqlDbType.Int);
23 System.Data.SqlClient.SqlParameter pdeals_new = objCmd.Parameters.Add("@deals_new", System.Data.SqlDbType.Int);
24 System.Data.SqlClient.SqlParameter poffers_new = objCmd.Parameters.Add("@offers_new", System.Data.SqlDbType.Int);
25 System.Data.SqlClient.SqlParameter pinterviews_taken_place_new = objCmd.Parameters.Add("@interviews_taken_place_new", System.Data.SqlDbType.Int);
26 System.Data.SqlClient.SqlParameter pinterviews_arranged_new = objCmd.Parameters.Add("@interviews_arranged_new", System.Data.SqlDbType.Int);
27 System.Data.SqlClient.SqlParameter punique_mailshots_sent_new = objCmd.Parameters.Add("@unique_mailshots_sent_new", System.Data.SqlDbType.Int);
28 System.Data.SqlClient.SqlParameter pmailshots_new = objCmd.Parameters.Add("@mailshots_new", System.Data.SqlDbType.Int);
29 puserid.Value = Convert.ToInt16(userid.Text);
30 pdate.Value = Convert.ToDateTime(date.Text);
31
32 objCmd.ExecuteNonQuery();
33 objConn.Close();
34

 
Thanks in a dvance
 
Dave

View 4 Replies View Related

Problems With SQL And Update From Form

Jun 19, 2008

I am trying to upgrade my site from Microsoft Access to SQL and it runs fine except when I try do the update from the webform. BElow is my code. If someone can see why it is happening that would be great:
 The error I get is: Line 1: Incorrect syntax near 'nvarchar'.
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="HIGHWAY" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
&nbsp;<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NCCAUTHConnectionString %>"
DeleteCommand="DELETE FROM [TblMain] WHERE [ID] = @ID" InsertCommand="INSERT INTO [TblMain] ([ID], [Auth No], [Caller], [Date], [Time], [H S No], [Type], [Contractor], [Origin], [Destination], [Modification Requested], [Trailer Number], [Pull Date], [Pull Time], [Contractor Date], [Contractor Time], [CDO], [Message Number and comments]) VALUES (@ID, @Auth_No, @Caller, @Date, @Time, @H_S_No, @Type, @Contractor, @Origin, @Destination, @Modification_Requested, @Trailer_Number, @Pull_Date, @Pull_Time, @Contractor_Date, @Contractor_Time, @CDO, @Message_Number_and_comments)"
SelectCommand="SELECT * FROM [TblMain]" UpdateCommand="UPDATE [TblMain] SET [Auth No] = @Auth_No, [Caller] = @Caller, [Date] = @Date, [Time] = @Time, [H S No] = @H_S_No, [Type] = @Type, [Contractor] = @Contractor, [Origin] = @Origin, [Destination] = @Destination, [Modification Requested] = @Modification_Requested, [Trailer Number] = @Trailer_Number, [Pull Date] = @Pull_Date, [Pull Time] = @Pull_Time, [Contractor Date] = @Contractor_Date, [Contractor Time] = @Contractor_Time, [CDO] = @CDO, [Message Number and comments] = @Message_Number_and_comments WHERE [ID] = @ID">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Auth_No" Type="String" />
<asp:Parameter Name="Caller" Type="String" />
<asp:Parameter Name="Date" Type="String" />
<asp:Parameter Name="Time" Type="String" />
<asp:Parameter Name="H_S_No" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="Contractor" Type="String" />
<asp:Parameter Name="Origin" Type="String" />
<asp:Parameter Name="Destination" Type="String" />
<asp:Parameter Name="Modification_Requested" Type="String" />
<asp:Parameter Name="Trailer_Number" Type="String" />
<asp:Parameter Name="Pull_Date" Type="String" />
<asp:Parameter Name="Pull_Time" Type="String" />
<asp:Parameter Name="Contractor_Date" Type="String" />
<asp:Parameter Name="Contractor_Time" Type="String" />
<asp:Parameter Name="CDO" Type="String" />
<asp:Parameter Name="Message_Number_and_comments" Type="String" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="Auth_No" Type="String" />
<asp:Parameter Name="Caller" Type="String" />
<asp:Parameter Name="Date" Type="String" />
<asp:Parameter Name="Time" Type="String" />
<asp:Parameter Name="H_S_No" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="Contractor" Type="String" />
<asp:Parameter Name="Origin" Type="String" />
<asp:Parameter Name="Destination" Type="String" />
<asp:Parameter Name="Modification_Requested" Type="String" />
<asp:Parameter Name="Trailer_Number" Type="String" />
<asp:Parameter Name="Pull_Date" Type="String" />
<asp:Parameter Name="Pull_Time" Type="String" />
<asp:Parameter Name="Contractor_Date" Type="String" />
<asp:Parameter Name="Contractor_Time" Type="String" />
<asp:Parameter Name="CDO" Type="String" />
<asp:Parameter Name="Message_Number_and_comments" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:Button ID="Button1" runat="server" PostBackUrl="~/Test.aspx" Text="Add New Authorization" />
<asp:GridView ID="GridView1" runat="server" CellPadding="3" DataSourceID="SqlDataSource1" GridLines="Vertical"
Style="font-size: 8pt; font-family: Arial" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" Font-Bold="True" AllowSorting="True">
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<Columns>
<asp:CommandField ShowEditButton="True" />
</Columns>
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="Gainsboro" /></asp:GridView>
</asp:Content>

View 4 Replies View Related

Unable To Update SQL Table From A Web Form

Jan 20, 2006

I have a Table which stores data from two different databases. To update it I made a Web Form that opens a single record where you can edit the data (using TextBox). Then there is an Update Button, which is supoused to Update that record in the SQL Database. However, for some reason it does not work. I get no error and every thing seems to work fine, but the data is not updated. When running the same UPDATE statment in the SQL Query Analyzer everything works just fine. Here is the code for the button click (For test purpose I've set a spesific record to update the Task cell to "Test" and I've adde a DataGrid to be able to see if something is happening):
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim objConnection As SqlConnection
Dim objDataAdapter As SqlDataAdapter
Dim objDataSet As DataSet
Dim objDataView As DataView
Dim strConnect As String
Dim strSQL As String
Dim strUpdate As String
strConnect = "Persist Security Info=False;Integrated Security=SSPI;server=SRV01;database=DB1"
strSQL = "SELECT * FROM Users WHERE UserID ='" & Request.QueryString("UserID") & "'"
strUpdate = "UPDATE Users SET Task = 'Test' WHERE UserID = 36"     '" & Request.QueryString("UserID") & "'"
objConnection = New SqlConnection(strConnect)
objDataAdapter = New SqlDataAdapter(strSQL, objConnection)
objDataAdapter.UpdateCommand = New SqlCommand(strUpdate)
objDataSet = New DataSet
objDataAdapter.Fill(objDataSet, "User")
objDataView = New DataView(objDataSet.Tables("User"))
dgrTest.DataSource = objDataView
dgrTest.DataBind()
objDataAdapter.ContinueUpdateOnError = True
Try
objDataAdapter.Update(objDataSet, "User")
lblTest.Text = objDataAdapter.UpdateCommand.CommandText
Catch ex As Exception
lblTest.Text = "Error"
End Try
End Sub
 
Thank you for your much needed help in advance.
 

View 3 Replies View Related

Web Form To Update SQL Server 2005 DB

Jul 26, 2007

Bear with me plase as I am nto very familiar with the coding world. The project I am working on is giving me troubles. I am trying to set up a form that can be used on line for our sales staff. It is a call activity form that I was hoping to submit to the DB I Have created in SQL. I would like the sales staff to fill out this form and then have their information transferred to the DB so that I can generate reports from that data. The trouble I am having is getting the intial connection to the DB opened up using the submit button on the form. I go into the code behind the page, and I have entered many scripts with no success. I continue to see that I receive erros when I try to use the opening line:
Dim cn As New ADODB.Connection

If anyone out there has some sample scripting that would help me with this, I would really appreciate it. Thank you.

Marc

View 1 Replies View Related

On Formview Clicking Update Causes Form Data To Disappear?!?

Mar 24, 2008

Follow-up to:
http://forums.asp.net/t/1237676.aspx
The update command seems to be deleting my data.  If I set the Parameter "DefaultValue" to "NULL" then it updates that field to the literal string: NULL
WTH
Nick
<UpdateParameters>
<asp:Parameter Name="DevelopmentArea" Type="String"/>
<asp:Parameter Name="DevelopmentGoals" Type="String" />
<asp:Parameter Name="DevelopmentPlans" Type="String" />
<asp:Parameter Name="CurrentStatus" Type="String" />
<asp:Parameter Name="FutureState" Type="String" />
<asp:Parameter Name="DetermineFactor" Type="String"/>
<asp:Parameter Name="MentorRequested" Type="Boolean" DefaultValue="False"/>
<asp:Parameter Name="MentorList" Type="String"/>
<asp:Parameter Name="CheckPointDate" Type="DateTime" />
<asp:Parameter Name="DateUpdated" Type="DateTime" />
<asp:Parameter Name="PlanPKID" Type="Int32" />
</UpdateParameters>

View 6 Replies View Related

Form Field Returns Name With Double Quotes Instead Of Single Quote During Update Process.

Oct 3, 2007

I've a weird problem in my application. In of the pages, while trying to update the text box "Name", when I enter Linda's test, it gets saved as Linda''s test. I'm not sure if this is a problem due to SQL server. When I look at the stored procedure, I don't anything different. Also, when I update the table directly in SQL Server, the result is displayed in single quote. But if I update the field thro' the application, the returned name is with double quotes instead of single quote.  Has any of you faced problems like this? What am I missing? What do I need to do to get the name saved the way I entered (with single quotes) instead of double quotes?

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

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

How Do I .. Use A Dataview To Break Up Sqldatareader ? Please Help!

Feb 8, 2006

Hello,
I am using a sqldatareader to get back a whole set of data.
The columns are id, data_id and data_desc
for example, the collection is id   data_id   data_desc0    100       this is name for id 00    101       this is address for id 00    102       this is gender for id 01    100       this is name for id 11    101       this is address for id 11    102       this is gender for id 12    100       this is name for id 22    101       this is address for id 22    102       this is gender for id 23    100       this is name for id 33    101       this is address for id 33    102       this is gender for id 3
I want to be able to go thru' this list and break up for each id and create a txt file. So, i will have four text files.
txt0.txt will contain100, this is name for id 0 101, this is address for id 0102, this is gender for id 0
I would like to know, how do i use a dataview to break up the sqldatareader so i can then repeat the loop for each id and generate the text file.
I don't have a problem generating the text file.
Please let me know, how should i go about it.
Thanks a bunch,-Sean
 

View 1 Replies View Related

Setting The SQL For A Dataview At Runtime.

Apr 18, 2006

I don't know if this topic should go in this forum category or in the SQLDataSource forum.
I need to be able to provide SQL which varies based on what the user enters on a page.  However, this isn't as simple a providing parameters in the SQLDataSource control because the SQL changes depending on what the user selects.  For example, in a customer search page, they choose to search by either first name or last name from a drop down list and then enter the name to search for in a text box.  The dataview should display the matching customers.
How can I set this SQL based on the entered values while also keeping the paging and sorting capabilities of the dataview?  You don't seem to be able to set the SQL for an SQLDataSource at run time.

View 3 Replies View Related

Need Help With Sql Query Statement In ASP Form

Jan 28, 2008

I have an ASP form that takes the information that is entered on the form and inserts it into a Microsoft Access database.  It works great.  In addition to the fields from the form, I also want to add the current date into the InitDate field.  How would I modify the SQL query below to insert the current date into the COS database? conn.execute SqlQry        Sql =         "INSERT INTO COS ([Name of School], [Director of COS], [Address], [City], [State], [zip], [PhoneNumber], "        Sql = Sql &    "[general_notes], [type], [DEPT], ) "  
     Sql = Sql &    "VALUES ('" & m_CompanySchoolName & "',
'" & m_FullName & "', '" & m_StreetAddress & "', '"
& m_City        Sql = Sql &    "', '" & m_State &
"', '" & m_Zip & "', '" & m_TelephoneNumber & "', '"
& m_Message & "', 'COSMETOLOGY', '"        Sql = Sql  & m_Department &    "', '" & m_EmailAddress & "')"                response.write Sql        response.end        conn.execute Sql       

View 14 Replies View Related

SQL Query Question In My Web Form - Help

May 15, 2008

Greetings!
Is this a good SQL query to access two columns in my database and present this data in my web app?
string DataBaseCommand = "Select UserName, [Password] from PatientDemographics Where UserName = '" + txtUserName.Text + "' && [Password] = '" + txtPassword.Text + "'";
Thank you,
 
Eduardo

View 4 Replies View Related

SQL Server 2014 :: Loop And Query CSV Files In Folder Using Union All Query To Form Resultant Table On Server?

Jun 27, 2014

I am trying to run a UNION ALL query in SQL SERVER 2014 on multiple large CSV files - the result of which i want to get into a table in SQL Server. below is the query which works in MSAccess but not on SQL Server 2014:

SELECT * INTO tbl_ALLCOMBINED FROM OPENROWSET
(
'Microsoft.JET.OLEDB.4.0' , 'Text;Database=D:DownloadsCSV;HDR=YES',
'SELECT t.*, (substring(t.[week],3,4))*1 as iYEAR,
''SPAIN'' as [sCOUNTRY], ''EURO'' as [sCHAR],

[Code] ....

What i need is:

1] to create the resultant tbl_ALLCOMBINED table

2] transform this table using PIVOT command with following transformation as shown below:

PAGEFIELD: set on Level = 'Item'
COLUMNFIELD: Sale_Week (showing 1 to 52 numbers for columns)
ROWFIELD: sCOUNTRY, sCHAR, CATEGORY, MANUFACTURER, BRAND, DESCRIPTION, EAN (in this order)
DATAFIELD: 'Sale Value with Innovation'

3] Can the transformed form show columnfields >255 columns i.e. if i want to show all KPI values in datafield?

P.S: the CSV's contain the same number of columns and datatype but the columns are >100, so i dont think it will be feasible to use a stored proc to create a table specifying that number of columns.

View 9 Replies View Related

Programmatic Use Of SQLDataSource Not Returning Dataview

Sep 4, 2007

I am creating an ad-hoc reporting module for my website.  The user may select a list of columns and specify the WHERE for the report.  I build the select statement and the where statement and pass the info to a stored procedure.  The stored procedure accepts 3 select parameters and a 3 wherestmt parameters.  I finally got the SQLDatasource to work by setting the parameter values in the Selecting method of the SQLDatasource.  Binding it to a gridview shows me all my values.  Now, I am trying to programmatically call the select method of the SQLDatasource so I can get a dataview or datareader to manipulate further.  I am getting an null back when I call the select method.  Any ideas why? or a workaround?
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AssetMgmtRWConnectionString %>"SelectCommand="getAdhocRptData" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
<SelectParameters>
<asp:Parameter Name="strSelect" Type="String" />
<asp:Parameter Name="strSelect2" Type="String" />
<asp:Parameter Name="strSelect3" Type="String" />
<asp:Parameter Name="strWhere" Type="String" />
<asp:Parameter Name="strWhere2" Type="String" />
<asp:Parameter Name="strWhere3" Type="String" />
<asp:Parameter Name="bitDebug" Type="Boolean" />
</SelectParameters>
</asp:SqlDataSource>
 
<VB Code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Getting an error that the object is null? why is the above code not returning any data?
'Tried using a datareader and datasource.Dim rptview As IDataReader = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), IDataReader)
If rptview.Read Then
lblMsg.Text = "Got Rows"
End If
End Sub
Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting
'For this sp, need to set each paramater even if it is not being used. Setting it in the wizard
'does not work. Need to be set programmatically.
e.Command.Parameters("@strSelect").Value = "p.field1, p.field2 "
e.Command.Parameters("@strSelect2").Value = "s.field1, s.field2"
e.Command.Parameters("@strSelect3").Value = "a.field1, a.field2, a.field4, a.field5"
e.Command.Parameters("@strWhere").Value = "p.field3 is not null and a.field5 is null"
e.Command.Parameters("@strWhere2").Value = "'"
e.Command.Parameters("@strWhere").Value = ""
e.Command.Parameters("@bitdebug").Value = False
End Sub
 
thanks for any help.
 

View 2 Replies View Related

How To Bind TextBox Controls To DataView ?

Jun 11, 2006

Hi,
I use a filter on a dataview which has uniq rows. I need to bind several fields of the result filtered row to textboxes. Here the code :
protected void Page_Load(object sender, EventArgs e)    {        string id = Request.QueryString["id"];
        if (PreviousPage != null)        {            SqlDataSource dsPrev = (SqlDataSource)PreviousPage.FindControl("SqlDataSource1");
            DataView dv = (DataView)(dsPrev.Select(DataSourceSelectArguments.Empty));            dv.RowFilter = "dr_id='" + id + "' ";            dv.RowStateFilter = DataViewRowState.CurrentRows;
            txtFirstName.Text = // ???  FirstName Field
            txtLastName.Text= // ???  LastName Field
            txtAddress.Text=  // ???  Address Field                               }    }
   I don't know which cod to put in those lines.
   On the help of the dataView there is an example that use DataBindings. This example is in the DataView.RowFilter article:
Text1.DataBindings.Add("Text",view,"CompanyName");
The big problem is that I don't have a method or event call 'DataBindings'. I just have 'DataBind' method or dataBinding event and they both don't support the 'Add' method.
So how can I bound those controls to my filtered Dataview field value.
Thanks,
David

View 3 Replies View Related

How To Use MDX Script In RS Dimension Filter (dataview)

Mar 23, 2007

Hi, I need to create filter which retrieves data for current moment. [time].[date].lastchild is not an option because the calender in database is generated till following year (2008).

I guess script goes like..

[time].[date].currentmember

but it does not work.


I'm green with these MDX scripts.. I'd be very pleased if some one of you gurus could help me.

Best Regards,
Eeva

View 1 Replies View Related

Using LIKE And Wild Cards In Form Query

Dec 11, 2006

Hi,
I am using Visual Studio 2005. I am trying to create a ASP.net website and use a web form to get the results of an enquiry. It is almost the same as the presentation video on this website called "How to Create Data Driven Website", but I have added a new twist to it.  I want to use the "LIKE" instead of "=" in my SQL statement and I want to use wild cards in the parameter value that I enter.
<form id="form1" runat="server">    <div>        &nbsp;<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<%        dim str as string = "%" & textbox1.text & "%"        </%>        <asp:TextBox ID="TextBox2" runat="server" Visible="False" Text=str></asp:TextBox>        <asp:Button ID="Button1" runat="server" Text="Submit" Width="87px" BackColor="Khaki" ForeColor="Navy" PostBackUrl="~/Default.aspx" />
and the ControlID of the Datagrid will take in the value of "TextBox2" instead of "TextBox1" as so:
   <SelectParameters>                <asp:ControlParameter ControlID="TextBox2" DefaultValue="SO06000001" Name="SO" PropertyName="Text"                    Type="String" />
 However the syntax above does not work. May I ask what is the correct syntax?
Thanks.
Peter
 

View 2 Replies View Related

String Manipulation With Web Form Query

Feb 24, 2006

I'm trying to look up customer records by e-mail domain by using a text box on a Web form. So if I want to look for all my customers that have an aol e-mail domain, I would type aol.com in the text box and the sub routine would know to count 7 characters from the right and through those characters into maybe a parameter query. I'm having problems passing this in. I can count the characters properly by using:
dim strText = MyTextBox.Textdim intLength = strText.Length
but having problems starting here......
MyCommand.SelectCommand.Parameters("@email").Value = MyTextBox.Text
..............
but how would I ultimately feed this into my sql satement? Select * from Customers Where email = right(@email,intLength)
Help appreciated.
Frank
 
 

View 1 Replies View Related

Passing Value From A Access Form To A Query

Jun 23, 2006

Frustration has gotten the best of me on this one. Can anyone help?
I need to pass the current value in an Access Data Project (back-end is MS SQL) text field to the where condition in an SQL using VBA. This is what I have, but does not work.

Private Sub Command44_Click()
Me.SS.SetFocus
Dim strSQL As String
Dim strSSecurity As String
strSSecurity = Me.SS
strSQL = "Update Employees Set employees.PositionID = '',employees.jobcode = '' Where employees.ss = strSSecurity"
DoCmd.RunSQL strSQL
End Sub

It is supposed to take the current Social Security number from the form and match it against the employees table. Once it finds the matching record it should update the PositionID and JobCode fields to '' (empty string)
But it doesn't
Anyone with any ideas?
Thanks
Dan

View 2 Replies View Related

Using Query Or Vba ,transfer Data From One Form To

Feb 27, 2007

using a query or vba ,transfer data from one form to another,
table1 customers-form1 customer address,
table2 orders-form2 order address,
how do i transfer data from customer address to order address
yours M [/center]

View 1 Replies View Related

List Items From A Form Query

Feb 24, 2008

Hi,
I am a newbie, this is my first post (please go easy).

Iam at the moment trying to set up a query for someone looking for a property on an estate agents website.

From a drop down menu, the user can:
select an area (where they may like to live) from a list of areas.
select an amount of bedrooms from a list of bedrooms
select a minimum price from a list of prices
select a maximum price from a list of prices.

The query I worked out for this is as follows:
$data = mysql_query("SELECT * FROM property WHERE area like '$area' and bedrooms like '$bedrooms' AND price BETWEEN '$min_price' AND '$max_price'") or die(mysql_error());

This seems to work fine and shows all the properties that meet the criteria onto my webpage.

However, I then thought, someone may not care which area they live in and want to see all properties in all the areas, so I decided to add the option 'All areas' to my 'areas' list, I then did the same for the other lists, eg 'all bedrooms' option to my bedrooms list and so on.

I am now trying to write a query that incorporates where the 'all..' option is selected and have become very stuck!
Can someone set me off in the right direction for this.
I hope that makes sense?!?!

View 20 Replies View Related

How To Query And Show The Result In A Form

May 12, 2006

I am an beginner in VC#2005,

my question is:

I connect a table and transtorm to WM5.0 (PDAphone),

I don't know how to show the result of my query,

EX:

table1,(two column: name , phoneNo)

private void button1_Click(object sender, EventArgs e)
{
SqlCeConnection cn = null;
try
{
cn = new SqlCeConnection("Data source=\Programs files\sqltest1\sqlPDA.sdf");


SqlCeCommand cmd = new SqlCeCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from Table1 where phoneNo='0922123456'";


SqlCeDataAdapter da = new SqlCeDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = cmd;

}
finally
{
if (cn.State != ConnectionState.Closed)
{
cn.Close();
}

}
}

there is nothing happen, please help me.

thanks

View 3 Replies View Related

Cannot Convert Type 'int' To 'System.Data.DataView'

Feb 2, 2008

I have the following SqlDataSource in my page:<asp:SqlDataSource ID="sqlds" runat="server" ConnectionString="<%$ ConnectionStrings:cs %>"    SelectCommand="SELECT [Quest1], [Quest2], [Quest3], [Quest4], [Quest5] WHERE ([QuestID] = @QuestID)">    <SelectParameters>        <asp:Parameter Name="QuestID" />    </SelectParameters> In my code I get the following error: "Cannot convert type 'int' to 'System.Data.DataView'", I don't understand why I am getting this error because I am casting my SqlDataSource as type DataView when passing it to my DataView type.Code: protected void Chart(string record)    {        System.Data.DataView dv = (System.Data.DataView)sqlds.SelectParameters.Add("QuestID", System.TypeCode.Int32, record); //Error line       ...       ...       ...}If anyone could point me in the right direction I would be very grateful. 

View 5 Replies View Related

Select Query Form Multiple Databases

Dec 14, 2007

How do I write an sql statement to link tables in two databases and query them? For example: SELECT db1.table1.field1, db2.table1.field1 FROM Table1 INNER JOIN db1.table1.field1 ON db2.table1.field1 = db1.table1.field1
 
Thanks

View 6 Replies View Related

Hierarchy Query To Form Organization Structure

Jun 8, 2014

I need to write a sql that generate the hierarchy in an organization.Below an example

emplid empname supervisor_id superv_name
1 subu null null
2 vid 1 sub
3 ram 4 satis
4 satis 2 vid

i need an output to this query as below and also one important the supervisor ie supervisor_id and name is null is the top level,every employee also has to report to him and also to his all above supervisors.whoever joinng new to org the hierachy should be follwed

empid empname supervisor_id superv_name
3 ram 4 satis
4 satis 2 vid
2 vid 1 subu
4 satis 1 subu
3 ram 1 subu
3 ram 2 vid
5 kumar 1 subu
5 kumar 4 satis
5 kumar 2 vid
1 subu null null

View 1 Replies View Related







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