Webform Time Out Trying To Retrieve From Different Tables
Jun 9, 2006
I'm having a problem retrieving information from two different tables. Everytime i run a query which i type a source id into a textbox my page keeps timing out. What could be the problem? The tables i'm pulling from is profiles and phone. Here is the code. If someone could tell me what's going on id apperciate it. Thanks!
Dim queryString As String = "SELECT [profiles].[date_added], [profiles].[source_id], [RP_profiles].[fnam"& _
"e], [profiles].[lname], [profiles].[title], [phone].[number], [RP_phone"& _
"].[source_id] FROM [profiles], [phone] WHERE ([profiles].[source_id] = "& _
"@source_id)"
View 3 Replies
ADVERTISEMENT
Feb 27, 2008
Hi,I m using vwd2005 and sql express,c#.I have a question here.In my database i have a table named Table1(id,name,age,country,email,phone) The values for these fields are inserted from the webform.Id is auto generated.name and age is passed from the textbox within the webform.country is passed from dropdownlist within the webform.email and phone is passed from listbox(multiple email and phone) within the webform.Now my problem is i want to retrieve all these row values back into the textboxes,dropdownlist and listbox at the same timeon the click of the retrieve button within the web form . Further more i want to make few changes on it and update the database on the click of another button update within the form.I hope u are getting it.How would the query would be in this case.?can u demonstrate the concept in one simple running example along with code?thanks.jack.
View 3 Replies
View Related
Mar 25, 2008
Hello Everyone,I 've trying to retreive data back into webform from the database from past couple of weeks.But i m not able to retrieve it completely.Here is my scenario.I've tried to explain in detail but in simple language.I hope u will get my point.Ok here it is.plz run my code:-i have three tables in sql.they are:-grup(id,grp) (1,abc) (2,xyz) organization(id,oid,gid,organisation,orgphone) (1,1,1,ibm,1234567) (2,1,2,microsoft,6543210) (3,2,1,oracle,7654323) (4,2,2,apple,9876543) userform(id,title,name,address,email,organizationid) (1,mr,jack,usa,jack@jack.com,1) userform.aspx page<%@ Page Language="C#" AutoEventWireup="true" CodeFile="userform.aspx.cs" Inherits="userform" %><!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> <div style="text-align: center"> <table> <tr> <td style="width: 100px"> Title</td> <td style="width: 100px"> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>mr</asp:ListItem> <asp:ListItem>miss</asp:ListItem> <asp:ListItem>ms</asp:ListItem> </asp:DropDownList></td> </tr> <tr> <td style="width: 100px"> Name</td> <td style="width: 100px"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 100px"> Add</td> <td style="width: 100px"> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 100px; height: 26px;"> Email</td> <td style="width: 100px; height: 26px;"> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td> </tr> </table> </div> </div> <div style="text-align: center"> <div> <div> <asp:ScriptManager ID="ScripManager1" runat="server"> </asp:ScriptManager> <div> <table> <tr> <td style="width: 100px"> Group</td> <td style="width: 100px">
<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddl1_SelectedIndexChanged"> </asp:DropDownList></td> </tr> </table> </div> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <table> <tr> <td> Organisation </td> <td>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddl2_SelectedIndexChanged"> </asp:DropDownList> </td> </tr> <tr> <td> org-phone </td> <td> <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> </td> </tr> <tr> <td> </td> <td>
<asp:TextBox ID="TextBox5" runat="server"
Width="45px"></asp:TextBox></td> </tr> </table> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddl1" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> <br /> <table> <tr> <td style="width: 100px"> <asp:Button ID="Button1" runat="server" Text="save" OnClick="Button1_Click" /> </td> <td style="width: 100px"> <asp:Button ID="Button3" runat="server" Text="update" /></td> <td style="width: 100px"> <asp:Button ID="Button2" runat="server" Text="cancel" /></td> </tr> </table> </div> </div> </div> </div> </form></body></html>userform.cs page public partial class userform : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { AssignDDLDataSource(); ddl1_SelectedIndexChanged(null, null); } } private void AssignDDLDataSource() { // SqlConnection string sqlQry = "SELECT GRP DISPMEM, ID VALMEM FROM GRUP"; SqlCommand cmd = new SqlCommand(sqlQry, con); ddl1.DataSource = cmd.ExecuteReader(); ddl1.DataTextField = "DISPMEM"; ddl1.DataValueField = "VALMEM"; ddl1.DataBind(); } protected void ddl1_SelectedIndexChanged(object sender, EventArgs e) { AssignSubjectDDL(ddl1.SelectedValue); } private void AssignSubjectDDL(string val) { // SqlConnection string sqlQry = "SELECT ORGANISATION DISPMEM, GID VALMEM FROM ORGANIZATION where OID = '" + val + "'"; SqlCommand cmd1 = new SqlCommand(sqlQry, con); ddl2.DataSource = cmd1.ExecuteReader(); ddl2.DataTextField = "DISPMEM"; ddl2.DataValueField = "VALMEM"; ddl2.DataBind(); ddl2_SelectedIndexChanged(null, null); } protected void ddl2_SelectedIndexChanged(object sender, EventArgs e) { AssignTextBoxValues(ddl1.SelectedValue, ddl2.SelectedValue); } private void AssignTextBoxValues(string teamval, string memval) { // SqlConnection
string sqlQry = "Select ID,ORGANISATION,ORGPHONE from ORGANIZATION
where OID = '" + teamval + "' AND GID = '" + memval + "'"; SqlCommand cmd = new SqlCommand(sqlQry, con); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { TextBox5.Text = rdr["ID"].ToString().Trim(); TextBox4.Text = rdr["ORGPHONE"].ToString().Trim(); } } protected void Button1_Click(object sender, EventArgs e) { // SqlConnection
string sqlQry = "INSERT into USERFORM (title, name, address, email,
organizationid) VALUES(@title,@name,@address,@email,@organizationid)"; SqlCommand cmd = new SqlCommand(sqlQry, con); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("title", DropDownList1.SelectedValue.Trim()); cmd.Parameters.AddWithValue("name", TextBox1.Text); cmd.Parameters.AddWithValue("address", TextBox2.Text); cmd.Parameters.AddWithValue("email", TextBox3.Text); cmd.Parameters.AddWithValue("organizationid", TextBox5.Text); cmd.ExecuteNonQuery(); Response.Redirect("detailsview.aspx"); }} detailsview.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="detailsview.aspx.cs" Inherits="detailsview" %><!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:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" EnablePagingCallbacks="True" Height="50px" HorizontalAlign="Center" Width="125px"> </asp:DetailsView> </div> </form></body></html> detailsview.cspublic partial class detailsview : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { //SqlConnection
string str = "select title,name,address,email,grp,organisation,orgphone
from userform as a inner join organization as b on
a.organizationid=b.id inner join grup as c on b.oid=c.id"; SqlDataAdapter oda = new SqlDataAdapter(str, conn); conn.Open(); DataSet ods = new DataSet(); oda.Fill(ods, "info"); DetailsView1.DataSource = ods.Tables["info"].DefaultView; DetailsView1.DataBind(); }}My problem :-Now when user fills up the userform and clicks the save button the details are shown in the details view.Now i want to add a Edit hyperlink next to the records in the detailsview so that when i click on it i would be redirected to userform.aspx form with all the textboxes,dropdownlist etc be populated from the related data from the database.(here table userform).Now i want to edit these data in the userform.aspx page and finally when i click the update button at end i want all the data be updated in the database aswell as in details view too.at the same time i want this form to redirect to detailsview.aspx .i hope ur getting it?i m able to do partial part only.Not completely. So can u now help me modify the code accordingly?Thanks in advance.Jack.
View 4 Replies
View Related
Jul 20, 2005
Hi,I am going to be difficult here... How do I retrieve one row at atime from a table without using a cursor?For example, I have a table with 100 rows. I want to retrieve thedata from row 1, do some stuff to it and send it on to anther table,then I want to grabrow 2, do some stuff to it and send it to another table.Here is how I am envisioning it:WHILE arg1 < arg2 {arg1 is my initial row, arg2 would be by totalrowcount)BEGINSELECT * FROM [TABLE] BUT ONLY ONE ROW.... MANIPULATE THE DATAINSERT into another tableENDOther notes, I am using SQL Sever 2000....Thanks and in advance and as always the help is greatly appreciated.Regards,CLR
View 4 Replies
View Related
Sep 18, 2007
Hello,
Some advice appreciated on the following, thanks!
I have this query:
select field1, field2, astartdate, anenddate
from atable
where astartdate BETWEEN '9/11/2007 12:00:00 AM' AND '9/18/2007 11:59:59 PM'
I need the results to be like the following:
field1,field2,anenddate-astartdate <<that's minus
Thank you for the help!
--PhB
--PhB
View 1 Replies
View Related
Mar 8, 2005
Dear Participants,
We are using merge replication for multi locational database but we are facing one problem in only one table which is not included in replication-
Table name is xxxxmast has only 39 row static information, but it used by every users for all task as select only information from this table like-
Select fin_year into mem_variable from xxxxmast where co_name = :global_variable
go
Code validation from here only.
Right validation from here only.
Report retrival validation from here only.
It means its usage for select from every user frequentely for so many times but we have to only fetch information from this table.
It was working prior fine but rightnow get problem for while-
Today Dated 08-March this table not accessible fro three times in eight hours-
1st time for 10 minute.
2nd time 10 minutes
3rd time 52 minutes.
Users want to login but at the login time years and other validation from this table, so users awaited for above mention time.
We had have do following by yesterday-
Drop table xxxxmast.
Create table xxxxmast.
Insert required data.
This is realy trouble for our application.
Any help realy great for us.
Thanks
R.Mall
View 3 Replies
View Related
Feb 6, 2004
Hi all
I am about updating some fields with local date and time using blw API
Quote
Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Public Function LocalDateTime()
Dim MyTime As SYSTEMTIME
GetLocalTime MyTime
Debug.Print "The Local Date is:" & MyTime.wMonth & "-" & MyTime.wDay & "-" & MyTime.wYear
Debug.Print "The Local Time is:" & MyTime.wHour & ":" & MyTime.wMinute & ":" & MyTime.wSecond
End Function
Unquote
This works fine however due to it's not really easy for an administrator to keep checking every times wheter local date and time are correctly updated for each front end users computer i would that to reconsider my function and making it to read local date and time from remote SQL Server. my concern is to help administrator to save time as he should only need to ensure that Server is running with correct time...
thkx for any advise
View 1 Replies
View Related
Jul 19, 2007
I have no idea where to post this kind of question, so here it is!
I have a requirement to retrieve oracle 10 data into SS2000 in as near real-time as possible (stupid users!) and join with resident SS data for on-demand reporting. (We use SS replication to populate some reporting tables from other SS2000 instances and this has spoiled the users as well as the developers! )
I would like to know if there are any clever ways of doing this, or if a plain-old DTS package running in some kind of loop is the practical answer. 1 minute delay is probably too long . . . I don't know if data can be pushed from the oracle side. Or if we need to write a Service and use it to suck and push.
Any suggestions?
thanks!
View 1 Replies
View Related
Apr 10, 2007
Hi all,
I have created several global temp tables to cache some intermediate results ...
However, it seems that after a while those tables will be dropped by SQL Server 2005 automatically (I have not restarted the server and no drop table statement ever executed against those tables). Is this a feature by design? How to make those global temp tables persistence to next service restart?
Thanks,
Ning
View 5 Replies
View Related
Aug 8, 2005
Hello;
I have two tables
Table 1 Rx
-------
RxNumber, RxId(no duplicates), RxDate, Name, Notes, Type, DOB
Table 2 Email
-------
EmailId, RxId(duplicates ok), Subject, Message, To, From, Type
I would like the result to be
Result Table
------------
Rx Id, RxDate, Name, Notes(or Subject), Type
Table 1 can be searched by date, or Name or DOB I want the result of this search to go through table 2 and return to me all emails that match thre previous results RxIds
For example Table 1
RxNumber, RxId, RxDate, Name, Notes, Type, DOB
1 99 1/1/2005 Person1 Note1 1 1/1/95
2 98 3/1/2005 Person2 Note2 1 1/1/96
3 97 5/1/2004 Person3 Note3 1 1/1/97
4 96 1/1/2004 Person4 Note4 1 1/1/98
5 95 6/1/2005 Person5 Note5 1 1/1/99
For Example Table 2
EmailId, RxId(dupl ok), Subject, Message, To, From, Type
1 100 S1 M1 T1 F1 2
2 98 S2 M2 T2 F2 2
3 101 S3 M3 T3 F3 2
4 95 S4 M4 T4 F4 2
5 98 S5 M5 T5 F5 2
6 95 S6 M6 T6 F6 2
7 96 S7 M7 T7 F7 2
8 98 S8 M8 T8 F8 2
9 100 S9 M9 T9 F9 2
10 100 S10 M10 T10 F10 2
If I do a search for Rxs that were prescribed from 1/1/2005 to 7/1/2005
I would like the resulting table to be
RxId RxDate Name Note/Subject Type
99 1/1/2005 Person1 Note1 1
98 3/1/2005 Person1 Note2 1
98 3/1/2005 Person2 S2 2
98 3/1/2005 Person2 S5 2
98 3/1/2005 Person2 S8 2
95 6/1/2005 Person5 Note5 1
95 6/1/2005 Person2 S4 2
95 6/1/2005 Person2 S6 2
I have tried a combination of inner joins and Union with no luck any suggestions
Thanks
Fernb200
View 2 Replies
View Related
Sep 20, 2004
I need to retrieve the available tables in a database in SQL Server 2000. I found this command and although it works I can't figure out how to filter the results.
exec sp_tables
I don't want to return the whole list, just the tables starting with "OV" and "SV". Does SQL Server 2000 support a wildcard? Like can I have it search for "OV*" or do I have to use LIKE. Did google search with no helpful results. I remember in mySQL this was simply "SHOW Tables" but this command isn't supported in SQL Server 2000.
any help would be appreciated
thanks
View 1 Replies
View Related
Apr 26, 2006
palli writes "how to retrieve data from two tables..."
View 2 Replies
View Related
Jan 25, 2008
I need to retrieve data from 2 tables (I have a sp that populates each table) regardless if they have a match or not.
First table:
#JobListTable
job_date datetime,
job_number char(15),
job_phase char(15),
qty_delivered decimal(8,2)
Second table:
#EquentialJobListTable
job_date datetime,
job_number char(15),
job_phase char(15),
qty_received decimal(8,2)
There could be a match between the two tables, or a record could exist in one and not in the other. Result will be loaded into a DataSet and dataGrig
Can I use a join?
View 2 Replies
View Related
Apr 10, 2007
(SQL 2005)I'm looking to create a stored procedure to first "select name fromsys.databases where name like '%site'" then pass each name to thefollowing using some kind of loop "USE @name select name fromsys.tables where type = 'U'"I tried a while statement, but the master sys.databases recordsetdoesn't change..It's the loop I can't get to work.Any help is greatly appreciated!
View 3 Replies
View Related
May 30, 2008
Hi guys , may I know is there any way for getting the information about the tables that most use frequently in the db?
Best Regards,
Hans
View 2 Replies
View Related
May 28, 2007
Hey,
I want retrieve data from 3 table my tables structure is this
tblUsers
U_ID - Name
3 John
tblGroups
G_ID - Name
5 Admins
6 Moderators
Now I want join some of the users to different groups for example John maby is a member of two groups (Admins and Moderators)
in order to do this I created a new table names tblGroupsUsers
tblGroupsUsers
ID - User_ID - Group_ID
1 3 5
1 3 6
its ok, but Now I don't know how to retrive my users list from database I don't know how to write a wuery for this
I have tried this :
strSQL = "SELECT tblUsers.name, tblUsers.U_ID, tblGroups.G_ID, tblGroupsUsers.Group_ID, tblGroupsUsers.User_ID FROM tblUsers INNER JOIN tblGroupsUsers ON tblGroupsUsers.User_ID = tblUsers.U_ID, tblGroups WHERE tblGroupsUsers.Group_ID = tblGroups.G_ID ORDER BY tblUsers.name ASC;"
Its working withut error but the problem is the results its like this
John
John
its will retrive the username twice , I think its reading based on tblGroupsUsers table because it has two rows ,
help please I need this how can I configure my query to get eache name once
Thanks
View 8 Replies
View Related
Jan 13, 2012
I want to join two tables of information together. I want to bring the order information together with the order charge. But since the OrderCharges table can have multiple values, I just want to retrieve the sum of those charges for a specific OrderID+ItemID.
My data looks something like this:
CREATE TABLE #OrderItems
(
OrderItemsID INT IDENTITY (1,1) PRIMARY KEY,
OrderID INT,
ItemID INT
)
SET IDENTITY_INSERT #OrderItems ON
[Code] ....
So I'm looking to see a result set that would like this this:
OrderItemsID-----ItemID-----OrderID----OrderDescription--OrderCharge
----1------------124---------1------------Shipping----------6.55
----2------------156---------1------------Shipping---------16.85
----3------------156---------2------------Shipping----------7.40
----4------------158---------1------------Shipping----------7.85
----5------------158---------2------------Shipping---------15.25
View 2 Replies
View Related
Jun 29, 2015
We are accessing a database through Linked Servers. That database has a bunch of views.We are able to get a list of columns for our views by querying [syscolumns]. However, how do we find out which of those columns have primary keys?
View 6 Replies
View Related
Apr 30, 2008
Many HUGE Thanks to the person who knows how to do this.
Problem: My goal is to take a single data row (myDataRow) from some table (MyTable) and then retrieve every single associated record throughout the database that is related to that datarow. This requires me to first find out what tables are related to the starting table and then recursively pull all of the associated records until I get all of the records associated. Sounds simple right?
The following code only pulls back only those tables that have a child table
with an associated foreign key (i.e. a 1 -> many):
Select [Name] from sysobjects where xtype='U' and Id in(
select fkeyid from sysforeignkeys where rkeyid=
(Select Id from sysobjects where Name='<TableName>'))
order by name
But this query does not work backwards where I start with a child table
and want to know the parents (i.e. many->1 relationship)
Anybody have a clue how to retrieve these parent related tables when starting with a child table? I know it can be done because SQL Server Management lets you select a table (child OR parent) and retrieve the related table(s).
Thank you for any direction you can suggest!
Best Wishes to All
-Eric
View 6 Replies
View Related
Apr 9, 2008
Hello, I am writing a website (in vb) to allow for room use reservations and I am looking for a way to compare the selected start and end times which are date-time format to records already in the database for that day/time and specific room. If the selected time does not fall within an already reserved time frame I then want to insert it into the table. I have already written a procedure to do the inserting and that works fine. I just want to validate it before calling the insert. Any ideas? The fields to be validated on the form are textboxes containing date time which populate as read only after the time selection is chosen from dropdown. Thanks in advance It's greatly appreciated.
View 7 Replies
View Related
Feb 20, 2006
Windows XP
SQL Expresss 2005
SQL Express 2005 Manager
I simply want to edit and data I have in a database that I made with Express Manager. This worked before .Net 2.0. Now, I have the table displayed as a datagrid with an "edit" pushbutton associated with each row in the database table. When I click on the "edit" pushbutton to edit a specific row in the database table, instead of posting me to a page where the chosen row is editable, I am posted back to the same page without the chosen row availible to be edited.
What am I doing wrong? How can I fix this? I am totally new to this so any help would be appreciated.
Cheers!
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" EnableEventValidation="false" %><%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %><MM:DataSet id="dsParts"runat="Server"IsStoredProcedure="false"ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_PartsAreUs"] %>'DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_PartsAreUs"] %>'CommandText='<%# "SELECT * FROM dbo.Parts" %>'Debug="true"> <EditOps> <EditOpsTable Name="dbo.Parts" /> <Parameter Name="Name" Type="VarChar" /> <Parameter Name="Description" Type="NVarChar" /> <Parameter Name="Price" Type="Money" /> <Parameter Name="PartID" Type="Int" IsPrimary="true" /> </EditOps></MM:DataSet><MM:PageBind runat="server" PostBackBind="true" /><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Untitled Document</title></head><body><form runat="server"> <asp:DataGrid id="dgParts" runat="server" AllowSorting="False" AutoGenerateColumns="false" CellPadding="3" CellSpacing="0" ShowFooter="false" ShowHeader="true" DataSource="<%# dsParts.DefaultView %>" PagerStyle-Mode="NextPrev" DataKeyField="PartID" onCancelCommand="dsParts.OnDataGridCancel" onEditCommand="dsParts.OnDataGridEdit" onUpdateCommand="dsParts.OnDataGridUpdate" onItemDataBound="dsParts.OnDataGridItemDataBound" > <HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" /> <ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" /> <AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" /> <FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" /> <PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" /> <Columns> <asp:EditCommandColumn ButtonType="PushButton" CancelText="Cancel" EditText="Edit" HeaderText="Edit" UpdateText="Update" Visible="True"/> <asp:BoundColumn DataField="PartID" HeaderText="PartID" ReadOnly="true" Visible="True"/> <asp:BoundColumn DataField="Name" HeaderText="Name" ReadOnly="false" Visible="True"/> <asp:BoundColumn DataField="Description" HeaderText="Description" ReadOnly="false" Visible="True"/> <asp:BoundColumn DataField="Price" HeaderText="Price" ReadOnly="false" Visible="True"/> </Columns> </asp:DataGrid></form></body></html>
View 3 Replies
View Related
Feb 27, 2008
Hi, i m using vwd 2005 express and sql express. i have created following tables table_office,table_customer,table_order in my sql express. i also added one more table named table_final. In my webform i have 2 textbox and submit button plus(controls to take values for table_office,table_customer,table_order).so when user fills the form and clicks the button the data gets inserted into thier respected tables.similarly table_final gets populated with values in this way (id,name,address,table_office_id,table_customer_id,table_order_id) Now when displaying the output in the gridview. i combined values of all these tables together. its fine till here. Now what i want is i want to write a query to retrieve these values back into the webform . Here i want the values from all the tables back into the webform controls on a click of a button.so that i can modify it manually, make updation on it and finally show it into gridview. i hope i m able to make u understand. anyway can somebody help me with simple code(C#) and sql query to achieve this task.? thanks. jack.
View 8 Replies
View Related
May 16, 2008
I have two tables that have no relation. However, both have a column which has a field of nvarchar(50) that I want to retrieve together in one operation and bind to a DropDownList in a sorted fashion. So, what I'm trying to achieve is this:
1. SELECT name FROM table1
2. SELECT name FROM table2
3. Join the two results together and order them alphabetically
4. Return the result set
I'm not sure how to do this or even if it's possible. Ideally I'm hoping it can be done in a stored proc.
View 6 Replies
View Related
Sep 17, 2007
Hi guys,
When I thought everything is okay with this script, I got a new problem...
I have a VBA's script from Excel 2003 that builds sql script and retrieves data from SQL SERVER 2000.
in order to make the sql running, I need to use a multi - batch processing, to pass and execute every command line once a time.
Up to here, I am using a test case with Account number = '123456' and getting the desire results.
The code below is running okay with the test case, but when changing the account number (mark as yellow in the code) to include all the accounts (or just one other account), I am getting the following ERROR:
run - time error '-2147217871 (80040e31)' - [Microsoft] [ODBC SQL Server Driver] time out expired.
Now, if I take the same code, with the condition that generates the ERROR, and try it into SQL Server, I get the results without errors.
Thanks in advance,
Aldo.
Below the code:
Code Snippet
Function QuerySalesAging()
'--------------------------------------------------------------
'MUST !!! References: Microsoft ActiveX Data Object 2.1 Library
'--------------------------------------------------------------
Dim ConnString As New ADODB.Connection
Dim RecordSet As New ADODB.RecordSet
'Setting Connection String
Driver = "{SQL Server}"
ServerName = "SERVER"
DB_Name = CompanyName
ConnString = "Driver=" & Driver & ";" & "Server=" & ServerName & ";" _
& "Database=" & DB_Name & ";" & "Uid=" & SQLLoginName & ";" & "Pwd=" & SQLPassword & ";"
'Report Criterias
Criteria05 = " AND " & "Accounts.ACCOUNTKEY Between " & AccountKeyAsRange
' -- ==> With AccountKeyAsRange = '123456' AND '123456' it works okay.
' -- ==> With any other value, in example AccountKeyAsRange = '123456' AND '9999999999' it get's ERROR.
CmdLine01 = " USE " & CompanyName
' Check and drop temporary table
TemporaryTableName = "CTE" ' The table is a regular one
CmdLine02 = " if object_id('" & TemporaryTableName & "') is not null exec('DROP TABLE " & TemporaryTableName & "') "
CmdLine03 = " SELECT ..."
CmdLine03 = CmdLine03 & " INTO " & TemporaryTableName
CmdLine03 = CmdLine03 & " FROM ..."
CmdLine03 = CmdLine03 & " WHERE " & "(" & Replace(Criteria05, "AND", "") & ")"
CmdLine03 = CmdLine03 & " ORDER BY ..."
CmdLine04 = CmdLine04 & " ALTER TABLE " & TemporaryTableName ...
CmdLine05 = CmdLine05 & " UPDATE " & TemporaryTableName ...
CmdLine06 = CmdLine06 & " SELECT ..."
CmdLine06 = CmdLine06 & " FROM ..."
ConnString.Open
ConnString.Execute CmdLine01
ConnString.Execute CmdLine02
RecordSet.Open CmdLine01, ConnString
RecordSet.Open CmdLine02, ConnString
RecordSet.Open CmdLine03, ConnString
RecordSet.Open CmdLine04, ConnString
RecordSet.Open CmdLine05, ConnString
RecordSet.Open CmdLine06, ConnString
ConnString.Execute CmdLine01
ConnString.Execute CmdLine02 ' The debbuger stops here:" if object_id('CTE') is not null exec('DROP TABLE CTE') "
ConnString.Execute CmdLine03
ConnString.Execute CmdLine04
ConnString.Execute CmdLine05
ConnString.Execute CmdLine06
ConnString.Execute CmdLine02
'Retrieve Field titles
For ColNr = 1 To RecordSet.Fields.Count
ActiveSheet.Cells(1, ColNr).Value = RecordSet.Fields(ColNr - 1).Name
Next
ActiveSheet.Cells(2, 1).CopyFromRecordset RecordSet
'Cleanup & Close ADO objects
ConnString.Execute "USE master"
ConnString.Close
Set RecordSet = Nothing
Set ConnString = Nothing
End Function
View 1 Replies
View Related
Aug 3, 2007
Can someone help with this? Let me know if what I'm trying to do is possible...
Here's code example:
@ClientID int,
@QuoteID int,
@Base real,
@One real,
@DwellingLimit real
AS
BEGIN
Insert Into tblOne(ClientID,QuoteID,GuideID,GuideRate,GuideMult,Premium)
Select @ClientID, @QuoteID, GuideID,GuideRate, @+"GuideMult"+,GuideRate*GuideMult
From tblTwo
Where Choose = 'True';
END
I need the value stored in tblTwo.GuideMult (ie. One, BaseRate) to be translated
into the numerical value shown on a webform (ie. @One, @BaseRate) and then
insert the numerical values into tblOne.GuideMult
Clear as mud? Does somebody have a better way to do this?
View 1 Replies
View Related
Sep 10, 2015
Till recently we were using the following code to retreive schema information of columns of tables
Dim schemaTable = connection.GetOleDbSchemaTable( _
System.Data.OleDb.OleDbSchemaGuid.Columns, _
New Object() {Nothing, Nothing, tableName, Nothing})
Now instead of getting the name of table (which i was using as param for filtering) i'm going to receive a sql-query. Now my question is if I were to get a query like the following :
SELECT
[EmployeeID],
[Title] + ' ' + [LastName] + ' ' + [FirstName] AS FullName,
[BirthDate],
[Address],
[City] + ', ' + [Region] + ', ' + [Country] + ' - ' + [PostalCode] AS FullAddress
FROM [dbo].[Employees]
Then how can I retrieve the schema information of only the columns present in the query.
(Its possible that i might get a query with multiple tables with joints)...
View 3 Replies
View Related
Mar 30, 2007
Hello all,
I am having problems running a stored proc from an aspx.cs file. Basically I want to extract data from webForm controls and create a new record in a DB table. I have watched the "Getting Started" videos on thi site, and the only difference between my code and the code of the demonstrator is the connection string. My conn string:- dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectTblConnString"].ConnectionString;Demonstrator conn string:- dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings("ProjectTblConnString");When I debug with the string as shown by the demonstrator the error list reports that ConnectionStrings is a property and I am trying to use it as a mothod, which is fair enough, but I am just confused as how it worked for the demonstrator and not myself. When I debug with the code I used above I get no error, but nothing is inserted in the DB.Also, it looks as if the only class in my aspx.cs file that is actually being executed is PageLoad() - the remainder of the code seems to be ignored. Below is the entired aspx.cs file:- 1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11
12 public partial class CreateProject : System.Web.UI.Page
13 {
14 protected void Page_Load(object sender, EventArgs e)
15 {
16
17 if (User.Identity.IsAuthenticated == false)
18 {
19 Server.Transfer("Default.aspx");
20 }
21
22 if (chkbox_startDate.Checked == true)
23 {
24 txtbox_startDate.ReadOnly = true;
25 txtbox_startDate.Text = (System.DateTime.Now.ToString());
26 }
27
28 }
29
30 protected void btn_create_Click(object sender, EventArgs e)
31 {
32 //connection string for connecting to SQL Server DB
33 SqlDataSource dataSrc = new SqlDataSource();
34 dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectTblConnString"].ConnectionString;
35
36
37 //insert data in table using the CreateNewProject stored proc in the DB
38 dataSrc.InsertCommandType = SqlDataSourceCommandType.StoredProcedure;
39 dataSrc.InsertCommand = "CreateNewProject";
40 dataSrc.InsertParameters.Add("Project_Title", txtbox_title.ToString() );
41 dataSrc.InsertParameters.Add("Description", txtbox_desc.ToString() );
42 dataSrc.InsertParameters.Add("Start_Date", txtbox_startDate.ToString() );
43 dataSrc.InsertParameters.Add("Primary_Dev_Lang", list_devLang.ToString() );
44 dataSrc.InsertParameters.Add("Dev_Environment", list_devEnv.ToString() );
45 dataSrc.InsertParameters.Add("No_Junior_Devs", txtbox_juniorDevs.ToString() );
46 dataSrc.InsertParameters.Add("No_Senior_Devs", txtbox_seniorDevs.ToString() );
47
48 int rowsAffected = 0;
49 try
50 {
51 rowsAffected = dataSrc.Insert();
52 }
53 catch (Exception ex)
54 {
55 Server.Transfer(Error.aspx);
56 }
57 finally
58 {
59 dataSrc = null;
60 }
61
62 if (rowsAffected != 1)
63 {
64 label_confirm.Text = "Error, Contact system admin";
65 }
66 else
67 {
68 label_confirm.Text = "Success";
69 }
70
71 }//end btn_create
72
73 //if cancel is clicked set all values back to default
74 protected void btn_cancel_Click(object sender, EventArgs e)
75 {
76 txtbox_title.Text = "";
77 txtbox_desc.Text = "";
78 txtbox_startDate.Text = "";
79 txtbox_seniorDevs.Text = "";
80 txtbox_juniorDevs.Text = "";
81 list_devEnv.SelectedIndex = 0;
82 list_devLang.SelectedIndex = 0;
83 chkbox_startDate.Checked = true;
84 label_confirm.Text = "";
85 }
86
87 //if checked the current dateTime is inserted into txtbox
88 protected void chkbox_startDate_CheckedChanged(object sender, EventArgs e)
89 {
90 if (chkbox_startDate.Checked == true)
91 {
92 txtbox_startDate.ReadOnly = true;
93 txtbox_startDate.Text = (System.DateTime.Now.ToString());
94 }
95 else
96 {
97 txtbox_startDate.ReadOnly = false;
98 txtbox_startDate.Text = "";
99 }
100 }//end chkox
101
102
103 }//end class
Any help anyome can give is greatly appreciated. This is part of my Final Year College Dissertation which is due in 3wks !!!!
Sláinte á chaire,
Seán
View 2 Replies
View Related
Oct 21, 2007
HiI have a VB.net web page which generates a datatable of values (3 columns and on average about 1000-3000 rows).What is the best way to get this data table into an SQL Server? I can create a table on SQL Server no problem but I've found simply looping through the datatable and doing 1000-3000 insert statements is slow (a few seconds). I'd like to make this as streamlined as possible so was wondering is there is a native way to insert all records in a batch via ADO.net or something.Any ideas?ThanksEd
View 1 Replies
View Related
Nov 19, 2007
Hi,
I would like to know how to call a report from a report viewer control in a web application. The reporting services is forms authenticated. I've done this authentication using the sample solution given by microsoft (adding custom security extension). Now am able to view the reports from Report manager and Report server URL. But i dont know how to authenticate the user from my web application and pass the credentials to the report server to view the report in report viewer control. Can somebody help in this? its bit urgent. Thanks in advance
View 1 Replies
View Related
Aug 3, 2001
i need to insert data into 2 tables. first in one, and the id of the register i just inserted is a field from the register in the other table (+ other data). inserting in this 2 tables should be invisible to the user so it has to be done automatically.
the dumb way i guess would be using 2 ADODB.recordsets (rs,rs1). first insert in one store the id in a var (after rs.update, rs.movelast, var=rs.fields("id")) and after this inserting a register in the new recordset (rs1)
is there a better way to do it?? any ideas??
thanx
View 2 Replies
View Related
Nov 1, 2004
Hi
After running some queries, I want to know which tables have been updated in the database in sql server.
Is there a way to find out the last updated time of all the tables in the database?
Thanks
Madhukar Gole
View 1 Replies
View Related
Oct 19, 2007
Hi,
I have a table in Sql 2005 called
Customers
CustomerId
CustomerName
CustomerAge
CustomerRank
CustomerStCode
I have to transfer the records into 2 tables
CustomerMaster
CustomerId
CustomerStCode
CustomerDetails
CustomerId
CustomerName
CustomerAge
CustomerRank
I have to pick up a row from Customers and transfer it to CustomerMaster and CustomerDetails. CustomerId of CustomerMaster will be the CustomerId of CustomerDetails while transfer. Similarly for all other rows in Customers.
How to do this?
thanks
View 5 Replies
View Related