Im trying to display data from a database based on an input value. The value in the Label12.Text which is("hotmail") is the input value thats stored in the database, this value is been searched for in the strSQL.
Dim strSQL As String = "SELECT Name FROM Jobseeker WHERE Email='" & Label12.Text & "' "
strSQL = Label5.Text
the code builds successfully, but Label5.Text appears blank.
Hi I'm new to all of this. I have a database that holds customer information (fictitious) and i can select that data and display it in a set of textboxes. I also have an SQL command "UPDATE" that is designed to update the text field that i want to edit. However the problem i'm having is that it'll let me write the info in the textbox but as soon as i click my update button it just flashses and goes back to what it says before e.g. FIRST NAME: LEE i enter TOM and then it reverts it back to LEE 1 2 Partial Class Update 3 Inherits System.Web.UI.Page 4 5 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 6 custIDTextBox.Text = Session("Label2") 7 8 Dim updatepage As System.Data.DataView = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), System.Data.DataView) 9 10 For Each update As Data.DataRow In updatepage.Table.Rows 11 12 firstnameTextbox.Text = update.Item("First Name").ToString 13 lastnameTextBox.Text = update.Item("Last Name").ToString 14 addressTextBox.Text = update.Item("Address Line 1").ToString 15 townTextBox.Text = update.Item("Town").ToString 16 postcodeTextBox.Text = update.Item("Postcode").ToString 17 telephoneTextBox.Text = update.Item("Tel Number").ToString 18 19 Next 20 21 End Sub 22 23 Protected Sub updatebutton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles updatebutton.Click 24 25 'Dim parameters firstnameTextBox, lastnameTextBox, addressTextBox, townTextBox, postcodeTextBox, telephoneTextBox 26 'Dim UpdateParameters As QueryStringParameter 27 28 SqlDataSource1.Update() 29 SqlDataSource1.UpdateParameters.Add("@CustomerDetails", System.TypeCode.String) 30 'SqlDataSource1.UpdateParameters.Add("@Last Name", System.TypeCode.String) 31 'SqlDataSource1.UpdateParameters.Add("@Address line 1", System.TypeCode.String) 32 'SqlDataSource1.UpdateParameters.Add("@Town", System.TypeCode.String) 33 'SqlDataSource1.UpdateParameters.Add("@Postcode", System.TypeCode.String) 34 'SqlDataSource1.UpdateParameters.Add("@Tel Number", System.TypeCode.String) 35 36 'Label2.Text = ("Update successful") 37 End Sub 38 End Class 39
This is my SQL UPDATE command statement: UPDATE CustomerDetails SET [First Name] = @firstnameTextBox, [Last Name] = @lastnameTextBox, [Address line 1] = @addressTextBox, Town = @townTextBox, Postcode = '@postcodeTextBox', [Tel Number] = '@telephoneTextBox'
Hello, my problem is that I have 2 textboxes and when the user writes somthing and clicks the submit button I want these values to be stored in a database table. I am using the following code but nothing seems to hapen. Do I have a problem with the Query (Insert)??? Or do I miss something else. Please respond as I can't find this. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Manufacturer2.aspx.cs" Inherits="Manufacturer2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"><title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /> <asp:Label ID="Label2" runat="server" Text="Password"></asp:Label> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="INSERT INTO Manufacturer(Name, Password) VALUES (@TextBox1, @TextBox2)"> <SelectParameters> <asp:ControlParameter ControlID="TextBox1" Name="TextBox1" PropertyName="Text" /> <asp:ControlParameter ControlID="TextBox2" Name="TextBox2" PropertyName="Text" /> </SelectParameters> </asp:SqlDataSource>
ASP 3.5 VB: Visual Studio 2008, 2005 Developer Server I'm new to web development so my question may seem basic. I created a stored procedure:CREATE PROCEDURE [dbo].[CaseDataInsert] @ReportType varchar(50), @CreatedBy varchar(50), @OpenDate smalldatetime, @Territory varchar(10), @Region varchar(10), @StoreNumber varchar(10), @StoreAddress varchar(200), @TiplineID varchar(50), @Status varchar(50), @CaseType varchar(200), @Offense varchar(200)
AS BEGININSERT CaseData(ReportType, CreatedBy,OpenDate,Territory,Region,StoreNumber,StoreAddress,TiplineID, Status,CaseType,Offense) VALUES(@ReportType,@CreatedBy,@OpenDate,@Territory,@Region,@StoreNumber,@StoreAddress,@TiplineID, @Status,@CaseType,@Offense) END
I created textboxes and dropdownboxes on my asp page, and with a button put the following code behind it:Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim cs As String = "Data Source=localhost;Initial Catalog=Database1.mdf;Integrated Security=True;"Using con As New System.Data.SqlClient.SqlConnection(cs) con.Open()Dim cmd As New System.Data.SqlClient.SqlCommand cmd.Connection = con cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "CaseDataInsert"cmd.Parameters.AddWithValue("@ReportType", DropDownList1.SelectedItem) cmd.Parameters.AddWithValue("@CreatedBy", DropDownList2.SelectedItem)cmd.Parameters.AddWithValue("@OpenDate", TextBox1.Text) cmd.Parameters.AddWithValue("@Territory", TextBox2.Text)cmd.Parameters.AddWithValue("@Region", DropDownList3.SelectedItem) cmd.Parameters.AddWithValue("@StoreNumber", TextBox3.Text)cmd.Parameters.AddWithValue("@StoreAddress", TextBox4.Text) cmd.Parameters.AddWithValue("@TiplineID", TextBox5.Text)cmd.Parameters.AddWithValue("@Status", DropDownList4.SelectedItem) cmd.Parameters.AddWithValue("@CaseType", DropDownList5.SelectedItem)cmd.Parameters.AddWithValue("@Offense", DropDownList6.SelectedItem) End Using End Sub On the web page I can enter the data, click the button, and no data is entered into the database? I believe that I may have problems with the datasource? Any help would be appreciated.
If anyone has examples of pulling the text out of textboxes and passing it to a INSERT statement which then puts the data into a SQL database table please if you could pass this on that would be great.
Hi, Ive got a report using a List item that is vertically displaying the columns from a table. The problem I run into, is that some of the fields in this table contain large blocks of text where the users have entered comments and such.
I am using Textboxes to display this data.
So my report will look something like ----- Field label 1 Field value 1 Field label 2 Field value 2 Field label 3
<white space>
<page break>
Field value 3 ---> this is a big block of text Field label 4 Field value 4 etc ------ It appears as though the report attempts to keep the contents of each textbox together even if that means breaking onto an entirely new page to do this. I would prefer for the data to flow more natrually instead where the page breaks in the middle of the data being displayed should it be too large to fit on the page it started on.
----- Field label 1 Field value 1 Field label 2 Field value 2 Field label 3 Field value 3 --- As much as can fit on this page
<page break>
Field value 3 ---> remaining data that broke over the page Field label 4 Field value 4 etc ------
I am trying to set a variable to be passed to my asp page but the value is not carrying over. I don't even know if this is supposed to work or not below: <td colspan="3" style="font-size: 10pt; vertical-align: top; color: <%=Div7fontcolor%>; background-color: <%=Div7bgcolor%>; text-align: center; width: 0px;" id="TopBox" runat="server">
The above Div7fontcolor and Div7bgcolor are variables that I set in the VB file as shown below: Dim obConnection As SqlConnection = New SqlConnection("Data Source=localhostsqlexpress;Initial Catalog=OrgBoard;Integrated Security=True")Dim obCommand As SqlCommand = New SqlCommand("SELECT Divisions.*, Dept19.*, Dept20.*, Dept21.*, ConfigDisplay.* FROM Divisions CROSS JOIN Dept19 CROSS JOIN Dept20 CROSS JOIN Dept21 CROSS JOIN ConfigDisplay", obConnection) obConnection.Open()Dim dr As SqlDataReader = obCommand.ExecuteReader() dr.Read() Dim Div7bgcolor As String = dr("Div7color").ToString().Trim()Dim Div7fontcolor As String = dr("Div7textcolor").ToString().Trim() dr.Close() obConnection.Close()
The web page runs fine with no errors but the value does not carry over and change the property correctly. I am able to set the bgColor value of the TopBox within the VB file if I use "TopBox.BgColor = Div7bgcolor" but I can't set other values on my web page like the font color. If I can do this from the VB file then please correct me. Using variables within the page will allow me to set almost any value but I don't even know if what I want is possible. Any help is greatly apprectiated. Thank you,
Dont laugh; How do I create a simple sqlcommand in C# that shows data. I have the code for VB but I a missing something in the converstion. I know SQL but I dont get the simple steps of displaying data. I have got all of the Visual Basic stuff down I just need help with doing it by hand in C#. or point my to a URL so that I can get the code. Thanks
Hi all, this is a very basic question of diplaying a data. on my aspx page I have datasource that will return only ONE record. <asp:SqlDataSource ID="sdsCategoryName" runat="server" ConnectionString="<%$ ConnectionStrings:KaruselaConnectionString %>" SelectCommand="SELECT Title FROM tbh_Categories WHERE CategoryID=@categoryID "> <SelectParameters> <asp:QueryStringParameter DefaultValue="-1" Name="CategoryID" QueryStringField="id" Type="int32"/> </SelectParameters> </asp:SqlDataSource> on the server side I would like to manipulate the title of the page according to the data returned from the query: and on the behind code if (!this.IsPostBack && !string.IsNullOrEmpty(this.Request.QueryString["ID"])) { DataView dv2 = (DataView)sdsCategoryName.Select(arg); this.Title = string.Format(this.Title, dv2.Table.Columns[0].ToString()); dv2.Dispose(); } of course it doesn't work. my question is this. do we really have to put the query datasource on the client side?and secondly, how can I view the recorsd I recieves from the query?Thanks for the help.
Hi I have used the create user wizard to create a registration page my table stores the user details and user id. I am also using the login wizard to create a log in page . I now want to display the details of the currently logged in user usind details view and allow them to view and edit their details. where and how do i create the session varible anh how do I wtire the sql select statement say select first name from table1 where (the userid I stored earlier in a table when the user registered ) = (this should be the currently logged in user'id). I am a novice so I would appreciate code snippets My code in asp page for the details looks like this asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="SqlDataSource1" Height="50px" Width="125px"> <EditRowStyle BackColor="#CCFF99" /> <AlternatingRowStyle BackColor="#FFCCFF" /> </asp:DetailsView><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>" SelectCommand="SELECT [FirstName], [LastName], [City], [Listing] FROM [UserDetails] WHERE ([UserId] = @UserId)"> </asp:SqlDataSource>
novice This shows no data when I test it. I have tried the folling in the .vb page no luck. Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound Dim UserId As Integer = Me.DetailsView1.DataItem("userID")Session("_UserID") = UserId End Sub
Hi. Not sure which section this request needs to be put in, but i'm relatively new to SQL.
I have 1 table which contains an user_id (autonumber), user_name, and user_profile.
I have 2 other tables: config_version (cv) and config (c)
These two tables both access the user table (us) to view the user_id (which is required).
I want to be able to view the user_names for both "cv" and "c" on a seperate page. Using the code below, i'm lost. I created what i wanted in MS Access with the use of a 2nd table (this might be easier to understand than my rant above). However, I don't want a 2nd table.
Can someone provide me with a function, or the "answer" to my problem?
Highlighted Blue - just there to fill in the front page with data (not wanted) Highlighted Green - doesn't work, but was my first attempt
Code: public function ShowQuotes Dim objConn Dim objADORS Dim strSQL Dim row
Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = strConn objConn.Open
Set objADORS = CreateObject("ADODB.RecordSet") strSQL = "Select top 50 " strSQL = strSQL & " cv.config_version_id as cvid, cv.configuration_id as cid, cv.version_number as cnum" strSQL = strSQL & ", cv.status as cstat, cv.total_price as cprice, cv.modification_date as cmod, cv.version_description as cvrem" strSQL = strSQL & ", c.remarks as qrem" strSQL = strSQL & ", p.prod_description as pdesc, p.version as pvers, p.status as pstat" strSQL = strSQL & ", cust.customer_name as custname" strSQL = strSQL & ", us.user_nt_login as modname" strSQL = strSQL & ", us.user_name as usname" ' strSQL = strSQL & ", cv.user_id as modname" strSQL = strSQL & " from tbl_config_version as cv, tbl_configuration as c, tbl_product as p, tbl_user as us, tbl_customer as cust" strSQL = strSQL & strWhere 'SETS RESULTS TO BE UNIQUE strSQL = strSQL & " and us.user_id = c.user_id" strSQL = strSQL & " and cv.configuration_id = c.configuration_id" strSQL = strSQL & " and c.product_id = p.product_id" strSQL = strSQL & " and c.customer_id = cust.customer_id" strSQL = strSQL & strOrderBy & ";"
In sql server, multiple instances of data default to a row display or vertical. I need a set of data in sql2005 to view horizontally so I can us it in a crystal report. Here is my issue. gift.HonorKey, gift.HonorName, gift.HonorId 1211 Smith 1222 1244 Owens 4155
I need for the data to read like this: HonorKey1, HonorKey2, HonorName1, HonorName2, HonorId1, Honorid2 1211 1244 Smith Owens 1222 4155
the table name is gift_view
I would like to be able to create a view in sql analyzer, then save as an SQL View My direct email is jackfam@comcast.net
Hey All, This is really simple basic question, and it's just so I can start to learn about MVS. I have a sql-database called "Test" with a Table called "Agents" with just three colulms "ID", "FNAME" and "LNAME". On the Default Page I have three Textboxes and a submit Button, All I want to do is type "Select" criteria in Textbox1 and have Textbox2 Display the "Fname" and Textbox3 Display the "Lname". (Using VB in ASPX) Dim i As New SqlDataSource() i.ConnectionString = ConfigurationManager.ConnectionStrings("Test").ToString() i.SelectCommandType = SqlDataSourceCommandType.Text i.SelectCommand = ((((((Now What???)))))))
I have a sql database where i have descriptions of products stored. I insert text using a simple sql insert and that seems to work fine. But when i try to get these texts and display them in a gridview with an object data source thet brake rows are not displayed. The text is just display with now row brakes at all. How can i fix this so that i get it displayed in rows? Because its almost unreadable like ths.
Got a question here and as I am no expert programmer, this should be easy for you gurus. I have this fairly generic code I've created where I return data from an SQL table in a DataList control. I want to take it to the next level and return only the last record in the table, but I am unsure of how to do that. Perhaps I shouldn't even be using a DataList control, I'm not sure.
I have the following stored procedure in SQL 2000 and would like todiplay the database name where data is drawn from. I'm using 4databases db1, db2, db3, db4 which all have the same table (Table1)with identical column names (Surname, GivenNames).CREATE PROCEDURE [dbo].[x_searchwildcard] @varSurname VARChar(25)ASSelect a.Surname, a.GivenNamesFrom [db1]..Table1 As aWhere a.Surname LIKE @varSurname + '%'UNIONSelect a.Surname, a.GivenNamesFrom [db2]..Table1 As aWhere a.Surname LIKE @varSurname + '%'UNIONSelect a.Surname, a.GivenNamesFrom [db3]..Table1 As aWhere a.Surname LIKE @varSurname + '%'UNIONSelect a.Surname, a.GivenNamesFrom [db4]..Table1 As aWhere a.Surname LIKE @varSurname + '%'Order By a.Surname,a.GivenNamesGOI tried the followingSelect a.Surname, a.GivenNames, db_name()However it only gave me the name of the database where the storedprocedure is kept (in my case 'Common')I was hoping it would display results something like the followingSurname GivenNames Database------- ---------- --------Fred Smith db1Freddy Smith db2Fred Smith db3Fred Smithe db3Fred Smith db4Fred Smithye db4Instead I receiveSurname GivenNames Database------- ---------- --------Fred Smith commonFreddy Smith commonFred Smith commonFred Smithe commonFred Smith commonFred Smithye commonAny ideas?ThanksRick
Hello, Im new to SQL. Im currently having a table called Daily with 5 columns. TesterNames,Activity,Hours_given,Hours_used and Delta. I have grabbed the data for the first three colums from another table called Tester. For Hours_used I supposed to get the data from another server after i get the access but mean time i just put my own data so that i can check the value of Delta. Data for Delta column should be as below. Delta = Hours_given - Hours_used So How do I do the codings for this expression and display it in the same table. Output I need as below: TesterNames Activity Hours_given Hours_used Delta abc A 5 6 -1 def B 7 6 1
I have used INSERT INTO Daily ( TesterNames,Activity,Hours_given) SELECT ( Tester_ID,Weekday_Day,EntityWDD) FROM Tester and the first 3 columns are filled with the data needed. But when I use INSERT INTO DAILY(Delta) SELECT Delta = Hours_given - Hours_used FROM DAILY The output was like below TesterNames Activity Hours_given Hours_used Delta abc A 5 6 def B 7 6 Null Null Null Null -1 Null Null Null Null 1 Help me . thank you.
Everything works great on my development box. I am using GoDaddy for production (ASP.Net v2, SQL 2000). I am not receiving any errors, so I am stumped; no data from the database is displaying on the GoDaddy pages. I updated the connection string in web.config to this:
But I am unsure if this is the issue?? Any insights? This is the page I am working on: www.sugarandspicebakery.com/demo/bakery/default.aspx. So, the page displays fine, but it should be showing data from the database. This particular page uses a DataList with ItemTemplate. There is definitely data in the database, and I have even ran the same exact query from the code using the Query Analayzer on GoDaddt and it returned results I know there isn't much info to go by, but I am hoping someone has some insight since I have been trying to figure this out for days now! Thank youJennifer
I defined a stored procedure with a cursor inside for updating data. When I call it from an MSAccess client, it fails. When I execute it directly in a ISQL/w windows, it doesn`t fail but it displays me the data (wich is the reason for failing from MSAccess). Do somebody know if I could do it without displaying data in the screen ??
Hey all, hopefully this question is in the right spot. I'm writing a .NET app talking to a MS SQL 2000 DB. I have two date range input boxes, and I want to display the data (probably in a dataGrid) from those 2 certain dates. How do I go about this with my SQL server??
My DB table has a date field that I would use to search for the data between those two user specified dates. Any tips, examples, etc. would be greatly appreciated!!!
I have a procedure that allows a user to enter two dates to run a query. I would like to display those dates on the generated report underneath the title. "5-01-07 to 5-31-07" How would I do this?
I have a table where I need to display groupings of information. If there isn't any data for a given group, I still need to include that group and say "no applicable data" or somesuch underneath it. Any way of doing this?
Hi all. I want to display the data from this table (data provided below in my report) PlanId, ParticipantId, FundId, FundNames, Loans,PortfolioId, Act1, TotAct1, Act2, Totact2 etc.. Until act20, totAct20
18752 1041 Columbia Funds Trust VI: Columbia Small Cap Value Fund I; Class A Shares NULL NULL NULL BB 425.32 CT 0.00 DV 0.00 GL 17.40 TF 0.00 WD 0.00 OT 0.00 EB 442.72 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
18752 6204 Columbia Funds Series Trust: Columbia Small Cap Index Fund; Class A Shares NULL NULL NULL BB 120.09 CT 0.00 DV 4.04 GL 2.10 TF 0.00 WD 0.00 OT 0.00 EB 126.23 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
18752 10302 Columbia Funds Series Trust: Columbia Marsico 21st Century Fund; Class A Shares NULL NULL NULL BB 119.59 CT 0.00 DV 1.69 GL 10.41 TF 0.00 WD 0.00 OT 0.00 EB 131.69 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
18752 11010 Columbia Acorn Trust: Columbia Acorn International Select; Class A Shares NULL NULL NULL BB 125.06 CT 0.00 DV 0.33 GL 8.83 TF 0.00 WD 0.00 OT 0.00 EB 134.22 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
18752 11024 Columbia Acorn Trust: Columbia Acorn International; Class A Shares NULL NULL NULL BB 126.85 CT 0.00 DV 0.77 GL 10.07 TF 0.00 WD 0.00 OT 0.00 EB 137.69 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
I will have around 10 -15 records depending on how many funds the user has... and i want my report to look like this
InvestmentName Act1 (BB) Act2(CT) Act3(DV) Act4(TF) ..Act20 FundNames TotAct1 TotAct2 TotAct3 TotAct4 .. Totact5 so the data will be displayed for each fund in different rows..
I am storing the value acroynms and what they stand for a different table and i know there are 20 acroynms and i need to the description of that acronymn to show in the heading... How can i do it... I am trying to right a sproc for it... Any help will be greatly appreciated... if you need more information.. pls feel free to ask
can some one help me. im using visual studio.net 2005. its a web application.i have a database with attribute name logo. so i want to upload an image and save it into the database and than display it into the image box to preview how the image looks like.can some one please help me as i am very new in using C# codes and visual studio.net 2005
Can this be done in ASP.Net, as it stands my database views in my ASP.Net application are just standard Unlike the view in MS Access which shows the collapsable linked data below the data (from a different table)
Hello, I have around 7 ntext fields in my data base table and I am getting data from the data base table through executing stored procedure, But when I am displaying data using record set, few of the ntext fields in recored set are empty .Iam sure that these are having data in table. I am not sure why recordset is lossing that ntext field data?Because of this I am unable to display that data in web form. any ideas really appriciated. Thanks Ram
I am using SQL Server 2005 and SSRS 2005, and I am trying to display a PDF (image datatype, application/pdf filetype) from a SQL Database. There is no MIME option for PDF, so it seems my options are limited. Is there a way to display the PDF, or maybe convert the binary data at the database level?