Fetch Data From Sqldatasource
Jun 4, 2008hi,
im just a newbie in asp.net.
i have my sqldatasource and a label. i want to get the data from sqldatasource to the label. how can i do that.
need codes
hi,
im just a newbie in asp.net.
i have my sqldatasource and a label. i want to get the data from sqldatasource to the label. how can i do that.
need codes
Hello..
i develope a web projects of horoscope or astrology(http://demo.reallianzbussimart.com/allzodiac.aspx), there is an 12 Zodiaz sign and all the data call on this page through the Database , in this page i there is an one sql query ---- (Select Top 1 col from colour order by newid(),Select Top 1 num from number order by newid() ,Select Top 1 days from day order by newid() )
then all data call one by one change ..
when the refresh the page the value of all zodiac is change that is wrong ,,,
so what is the quary that one time in day the value off all zodiac is same next day the value has been change............................................
so please help me /...........
tell what is the process to not data change into the page refresh
Ashwnai
Hi,
I'm using a remote SQL Server Express database with a C# app, and to do so as most of you already know, there's no DataSource available, it's all around SQL. This poses a problem as when I want to browse (1 by 1 in my app, with search utility) the contents of a given table, I have to perform a Select command. Well the problem is when I do this it loads all records into a DataSet (or DataTable), which is fine by me, but one of my tables is expected to reach 400 or 500 records in a few months time. This will mean a lot of loading from the db once the app is launched. Is there a way to make this connection more efective? Thanks
Hi,
I have stored procedure with cursor
I have to use following
step 1 fetch RateValidDates into @Id_RateCode, @TheValidDate
.... get data
step 2 fetch prior from RateValidDates
... condition
step 3 fetch NEXT FROM RateValidDates into @Id_RateCode, @TheValidDate
... go to next record
Sql query analyzer output result of fetch NEXT FROM on the screen
What seeting should i use to avoid output on screen
(The reason My cursor takes about 8000 - 10000 rows when it's open)
My problem is that my:hustyp)[1] only fetches the first occurace of this tag. In my xmlfile this field is a repeating table created in infopath 2007. How do I manage to get the rest dynamically.
------XML-file---------------------------------------
<my:group1>
<my:group2>
<my:hustypTF>5</my:hustypTF>
</my:group2>
<my:group2>
<my:hustypTF>6</my:hustypTF>
</my:group2>
<my:group2>
<my:hustypTF>7</my:hustypTF>
</my:group2>
</my:group1>
-----------------------------------------------------
------T-SQL for fetching data from XML datatype------
WITH xmlnamespaces('http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-01-15T13:29:33' AS my)
SELECT FormData.value('(/my:xxx/my:Formular/my:group1/my:group2/my:hustyp)[1]', 'varchar(99)') AS IdFastBet
FROM MinaDekl
CROSS APPLY FormData.nodes('(/my:xxx/my:Formular/my:group1/my:group2/my:hustyp) as TempTab(testTab1)
-----------------
Hi,I have a table with two columns Task and Employee. It lists all thetasks and the assigned employees. The same task will have multipleroles with an employeename or 'manager' as the data.If I have the following data'sales', 'john''sales', 'manager''dev', 'manager''make_coffee', 'manager''browse', 'jane''browse', 'manager'I need to get the rows wherever an employee is named (sales and browsefor example) and get manager for the rest.I can make it in two queries. Look for not manager in one and then formanager. Is there anyway to get them in a single query?If I need to look for 'sales', I need to get 'john' and not 'manager'.How to do that in a single query?Another need is to list all tasks with assigned. So for the above, Ishould get the following list'sales', 'john''dev', 'manager''make_coffee', 'manager''browse', 'jane'with two queries, I will get'sales', 'john''browse', 'jane''dev', 'manager''make_coffee', 'manager'which is ok. Order/sequence is not important.TIA,Sreelatha
View 2 Replies View RelatedI am getting problem in fetching data from SQL using C++ program.
How to Fetch SQL Unicode characters?
I am using ODBC driver calls in C++ to fetch SQL data.
It is working fine with character data.
But for Unicode data it displays €œ????€? instead of data.
I am using SQL Server SQLSRV32.DLL for creating datasource.
Following is my code:
#include <windows.h>
#include <sqlext.h>
#include<srv.h>
#include<stdio.h>
#include <iostream.h>
#include <string.h>
int main(void)
{
void print_err2(RETCODE rc, SQLINTEGER type, SQLHANDLE handle);
HENV hEnv = NULL; // Env Handle from SQLAllocEnv()
HDBC hDBC = NULL; // Connection handle
HSTMT hStmt = NULL;// Statement handle
//UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "myDataSource";// Data Source Name buffer
USHORT *szDSN;
szDSN = (USHORT *) malloc (sizeof(USHORT) * 13);
szDSN= (unsigned short *)"myDataSource";
//UCHAR szUID[10] = "sa";// User ID buffer
USHORT *szUID;
szUID= (unsigned short *) "sa";
//UCHAR szPasswd[10] = "bmcAdm1n";// Password buffer
USHORT *szPasswd;
szPasswd= (unsigned short *) "bmcAdm1n";
char buff[9] = "Testing";
// UCHAR szSqlStr[128]= "INSERT into Quali (Colname) Values ('Testing')" ;
//UCHAR szSqlStr[150]= "select name ,default_database_name,default_language_name from sys.sql_logins" ;
USHORT *szSqlStr;
szSqlStr = (USHORT *) malloc (sizeof(USHORT) * 150);
szSqlStr= (unsigned short *) "select name ,default_database_name,default_language_name from sys.sql_logins" ;
RETCODE retcode;
//UCHAR sqlState; // buffer to store SQLSTATE
// UCHAR errMsg[256]; //buffer to store error message
// SWORD count;
USHORT *sqlState;
USHORT *errMsg;
sqlState= (USHORT *) malloc(sizeof(USHORT)*6);
errMsg= (USHORT *) malloc(sizeof(USHORT)*256);
SDWORD retcode3=NULL; // return code
SDWORD nativeErr; // native error code
SWORD realMsgLen; // real length of error message
// sprintf((char*)szSqlStr,"select name ,default_database_name,default_language_name from sys.sql_logins",buff);
// Allocate memory for ODBC Environment handle
cout<<"hEnv before SQLAllocEnv = "<<hEnv<<endl;
retcode= SQLAllocEnv (&hEnv);
cout<<"retcode= "<<retcode<<endl;
cout<<"hEnv after SQLAllocEnv = "<<hEnv<<endl;
cout<<"***********************";
// Allocate memory for the connection handle
cout<<"hDBC before SQLAllocConnect = "<<hDBC<<endl;
retcode= SQLAllocConnect (hEnv, &hDBC);
cout<<"retcode= "<<retcode<<endl;
cout<<"hDBC after SQLAllocConnect = "<<hDBC<<endl;
cout<<"***********************";
SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDBC);
// Connect to the data source using userid and password.
retcode = SQLConnect (hDBC, szDSN, SQL_NTS,szUID, SQL_NTS, szPasswd, SQL_NTS);
cout<<"retcode= "<<retcode<<endl;
if (retcode != SQL_SUCCESS )
{
retcode3 = SQLError(SQL_NULL_HDBC, hDBC, SQL_NULL_HSTMT, sqlState,&nativeErr,errMsg, 256, &realMsgLen);
// print_err(sqlState, nativeErr, errMsg, realMsgLen);
//print_err2(retcode,SQL_HANDLE_DBC,hDBC);
cout<<sqlState<<endl<<nativeErr<<endl<<errMsg<<endl<<realMsgLen;
}
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
cout<<"Connection established....!";
// Allocate memory for the statement handle
cout<<"hStmt before SQLAllocStmt = "<<hStmt<<endl;
retcode = SQLAllocStmt (hDBC, &hStmt);
cout<<"retcode= "<<retcode<<endl;
cout<<"hStmt after SQLAllocStmt = "<<hStmt<<endl;
cout<<"***********************";
/*
// Prepare the SQL statement by assigning it to the statement handle
retcode = SQLPrepare (hStmt, szSqlStr, sizeof (szSqlStr));
cout<<"Statement szSqlStr: "<<szSqlStr<<endl;
cout<<"Statement hStmt: "<<hStmt<<endl;
// Execute the SQL statement handle
retcode = SQLExecute (hStmt);
*/
retcode = SQLExecDirect(hStmt,szSqlStr, SQL_NTS);
UCHAR name[4000],defDBnm[4000],defLanguage[4000];
SDWORD retcode2, cbname, cbdefDBnm, cbdefLanguage;
retcode2=NULL;
if (retcode2 == SQL_SUCCESS)
{
retcode2 = SQLBindCol(hStmt, 1, SQL_C_CHAR, name, 4000, &cbname);
retcode2 = SQLBindCol(hStmt, 2, SQL_C_CHAR, defDBnm, 4000, &cbdefDBnm);
retcode2 = SQLBindCol(hStmt, 3, SQL_C_CHAR, defLanguage, 4000, &cbdefLanguage);
}
if (retcode2 != SQL_SUCCESS) /* warning or error returned */
{
retcode3 = SQLError(SQL_NULL_HDBC, hDBC, SQL_NULL_HSTMT, sqlState,&nativeErr,errMsg, 256, &realMsgLen);
//print_err(sqlState, nativeErr, errMsg, realMsgLen);
cout<<sqlState<<endl<<nativeErr<<endl<<errMsg<<endl<<realMsgLen;
}
cout <<"****************************************";
while (TRUE)
{
retcode2 = SQLFetch(hStmt);
if (retcode2 == SQL_SUCCESS || retcode2 == SQL_SUCCESS_WITH_INFO)
{
if (cbname == SQL_NULL_DATA) /* check null data */
printf("name: NULL");
else
printf("Name: %s", name);
if (cbdefDBnm == SQL_NULL_DATA)
printf("defDBnm name: NULL");
else
printf("defDBnm name: %s", defDBnm);
if (cbdefLanguage == SQL_NULL_DATA)
printf("defLanguage: NULL");
else
printf("defLanguage : %s", defLanguage);
}
else if (retcode2 == SQL_ERROR ) /* warning or error returned */
{
retcode3 = SQLError(SQL_NULL_HDBC, hDBC, SQL_NULL_HSTMT, sqlState,&nativeErr, errMsg, 256, &realMsgLen);
//print_err(sqlState, nativeErr, errMsg, realMsgLen);
cout<<sqlState<<endl<<nativeErr<<endl<<errMsg<<endl<<realMsgLen;
}
else /* if no more data or errors returned */
break;
}
// Project only column 1 which is the models
// SQLBindCol (hStmt, 1, SQL_C_CHAR, szModel, sizeof(szModel), &cbModel);
// Get row of data from the result set defined above in the statement
// retcode = SQLFetch (hStmt);
// Free the allocated statement handle
SQLFreeStmt (hStmt, SQL_DROP);
// Disconnect from datasource
SQLDisconnect (hDBC);
}
// Free the allocated connection handle
SQLFreeConnect (hDBC);
// Free the allocated ODBC environment handle
SQLFreeEnv (hEnv);
return 0;
}
void print_err2(RETCODE rc, SQLINTEGER type, SQLHANDLE handle)
{
//SQLCHAR SqlState, *sq = &SqlState[0];
SQLUSMALLINT *SqlState;
SqlState=(SQLUSMALLINT *) malloc (sizeof(SQLUSMALLINT)*6);
SQLUSMALLINT *sq = &SqlState[0];
SQLCHAR Msg[SQL_MAX_MESSAGE_LENGTH], *ms = &Msg[0];
SQLWCHAR SqlStateW, *sqw = &SqlStateW[0];
SQLWCHAR MsgW[SQL_MAX_MESSAGE_LENGTH], *msw = &MsgW[0];
SQLINTEGER NativeError;
SQLSMALLINT i=1, MsgLen;
RETCODE ret;
int j;
printf("Error number is %d", rc);
while (SQL_SUCCEEDED(SQLGetDiagRec(type, handle, i++,(unsigned short *) SqlState, &NativeError, (unsigned short *)Msg, sizeof(Msg), &MsgLen)) )
{
printf("State: %s Native Error Code: %d %s (%d)",
SqlState,NativeError,Msg, MsgLen);
}
}
Regards
Ketaki
I do an insert of the xml into the table and that works fine, but how do I split the tags to different tables. I have tried SSIS and a XML Source to an OLEDB Source, but since the xml file contains different groups that do not work.
The xml is created by Infopath and it seems like the groups are created if the components belongs to different sections.
Table1
id int,
xmltag xml
I am starting to be desperate, I really need some help solving this one way or another.
Hi,
I am using DTS (Data Pump Task) to fetch selective data from AS/400. The Selection is based on a table which is on SQL Server.
I can not fetch the whole data as data is huge & only want for particular items. How can I achieve this taks
Thanks
Shafiq
:confused:
I only found first or last function which means I can't show the data of others, is there any solution to solve this issue?
Thanks in advance.
Hi,
I am using SQL Server 2005 Mobile Edition & Merge Replication
in this I want to insert a record into table,
in that table I have taken UserID coloumn as auto incrementing Identity type.
In a book I read that,
If you are using an Identity column, you must find the next available number and reseed before an insert can be successful. You will also have to set up ranged identity columns on the published database to prevent errors when the new data is merged.
Now I want to ask here that, how should I ressed that value before inserting?????
any help in a form of CODe will be appriciated.....
thanks in advance...
I was working on a logic which I am not able to code after many attempts. I have an Excel sheet(Base_Data.xlsx) with two sheets as "Mapping" & "Data" with the below data:
Mapping sheet values:
Base_Column Data_Column
Employee Emp
Designation Desig
Organisation Org
Data sheet values:
Emp joindate Desig Gender Org
1234 10/10/2010 Consultant Male Microsoft
4546 25/01/2001 Sw engineer Female Pega
Now using the above base_Data file, I have a to prepare a destination Excel(Destination_File.xlsx) as below:
Employee Designation Organisation
1234 Consultant Microsoft
4546 Sw engineer Pega
I tried to achieve this using SSIS and C#.Net technologies.
how to fetch data from oracle database in sql server 2014
example:
oracle schema :t1
sql server :t2
now am in t2 sql server database
now am executing below query
select * from t1.tablename ;
I need the rows updated today in catalogue table irrelevant of timing. I tried all the below queries.
select * from CATALOGUE where CAT_DATE=CONVERT(datetime, CONVERT(varchar, GETDATE(), 101))
select * from CATALOGUE where CAT_DATE= CONVERT(date, getdate())
select * from CATALOGUE where CAT_DATE= cast(GETDATE() as date)
I am getting output only if the information updated on 04/21/2015 00.00.00.000 but not for other timings, For example
04/21/2015 03.30.00.000, 04/21/2015 07.17.00.000 and all.
How can I retrieve all the records updated today.
I have added one webpage designed in ASP.Net with C# and sql server 2005 as database. There is table for user registration in which there is a column for ProfileCreationDate the data type of that column is date time .
I would like to fetch data of those user who have created profile within 7 days. For getting desired result I am trying this query.
select Name ,Profession,ProfileCreationDate from tblRegistration where DATEDIFF ( Day , '" + System.DateTime.Now + "',ProfileCreationDate)<7 order by ProfileCreationDate DESC
System.DateTime.Now is a function for getting current date time in C#
The query is neither giving error nor giving desired result.
I have been trying to write a cursor to fetch required data from table but somehow its running forever and inserting duplicate records.
I have a temp table named getInvoice where I have five important columns
1. invoice number
2.group
3.invoice status
4. Invoice Expiration date
5. Creation date time
and some other columns.One invoice number can belong to one or more group and there can be one or more records for a particular invoice number and group.
An example is below :
InvoiceNumber Group InvoiceStatus InvoiceExpirationDate CreationDateTime
579312 01 3 NULL 2003-03-24 00:00:00
579312 01 2 2015-12-14 00:00:00 2005-12-24 00:00:00
579312 02 2 2003-12-21 00:00:00 2005-10-12 00:00:00
321244 01 2 2015-12-21 00:00:00 2005-10-12 00:00:00
321244 01 3 2010-12-21 00:00:00 2010-12-21 00:00:00
My query condition is complex and that is why Im facing problem retrieving the output.I need a cursor for getting distinct invoice number from the table and for each invoice number I need to get the latest record for each invoice number and suffix combination based on creationdateand time column and if that record has invoice status of 2 and also the invoice expiration date can be either null or greater than today's date, then I need to get that record and put it in a temp table.
The query I wrote is below
declare myData cursor for
select distinct invoiceNumber from #getInvoice
declare @invoiceNumber varchar(30)
open myData
fetch next from myData into @invoiceNumber
while @@FETCH_STATUS = 0
[Code] .....
This query runs forever and doesn't stop.
I am currently working with C and SQL Server 2012. My requirement is to Bulk fetch the records and Insert/Update the same in the other table with some business logic? How do i do this?
View 14 Replies View RelatedI have an excel sheet containing one column (ID_NO) with 400K rows. I have a database from where I have to fetch some other columns from a Netezza database. Initially I tried hardcoding all the 400K rows in the query that I wrote using filter WHERE ID IN ('1212','2334'). But after pasting all the 400K rows the query is running indefinitely.
I have imported all the ID in a SQL table (MY_LIST table). I used a DFT, and selected ODBC source, and selected my netezza server. Then in the 'Data access mode' I selected the SQL command from the dropdown.I pasted the same query that I wrote in Netezza. Is there any way to pull only for those records that I have pulled in my SQL table (MY_LIST) ?
I have a page containing a FormView, which gets its data from a SqlDataSource control and displays details of a job. Two of the fields are location and job title. I want to re-use this data to create a dynamic page title. I know I can do this by setting the Page.Title to what I want to, but do I have access to the data outside of the FormView to which the data source is bound? If so how? Or will I have to perform an additional SELECT statement to get this data again?
View 2 Replies View RelatedI am used to using asp.net 1.1
and I want to do the equivilent of the following with an SqlDataSource
da.fill(dst1)
lbl.text=dst1.tablename(0).fieldname
and what this does is fills the dataset with the information from the select command in the dataadapter and then gets the value for the first row of the fieldname
It doesnt seem like this should be that big of a deal, but it has become very frustrating trying to find the answer, does anyone know how to do this? Please post some demo code if possible
Hi Everybody,I have an ordinary SqlDataSource on my page <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:P4SConnection %>" ProviderName="<%$ ConnectionStrings:P4SConnection.ProviderName %>" SelectCommand="SELECT CO_Id,CT_Name,CO_Username,CO_Password,CO_Company,CO_Email,CT_Id,CT_Position,CT_Admin, CO_Session,CO_LastLogin FROM company_contact LEFT JOIN company ON company_contact.CT_Company = company.CO_Id WHERE (CT_Username= & LCase(txtName.Text) & "> </asp:SqlDataSource>How do i use any of these values?I know I can display the values in a GridView or something but I dont want to display them.I originaly was using ODBC and just used the followingDim Row As DataRow = thisTable.Rows(0) Dim lP_ID As String = Row(0).ToString() Dim TheContact As String = Row(1).ToString() Dim theName As String = Row(2).ToString() Dim thePassword As String = Row(3).ToString() Dim TheCompany As String = Row(4).ToString() Dim TheEmail As String = Row(5).ToString() Dim lP_ContactID As String = Row(6).ToString() Dim ThePosition As String = Row(7).ToString() Dim bAdmin As Boolean = Row(8).ToString() Dim sP_Session As String = Row(9).ToString() Dim sP_Last As String = Row(10).ToString()Then I could use the values wherever I wanted.How do I do this with a SqlDataSource?Thanks,G
View 4 Replies View RelatedOkay, I used the SQLDataSource control to get my data from the database
table. What or how do I retrieve individual data from the
sqldatasource? I want to do some string comparison and manipulation
before I display it to the browser. How can this be accomplish?
Help is appreciated.
i HAVE TRIED THE FOLLOWING CODE BUT ITS NOT WORKING AS I WANT TO FILTER IT ACCORDING TO THE VALUE OF DROPDOWNLIST I HAVE TRIED CONFIGURE THE SQLDATASOURCE. DATASOURCE MODE PROPERTY IS SET TO THE DATASERSTILL IT IS NOT SHOWING ANY RESULTS <%@ Page Language="VB" %> <!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> <h3>Search Jobs</h3> <table cellspacing="10"> <tr> <td valign="top" style="height: 162px"> <table border="0"> <tr> <td valign="top" style="width: 70px"> Location</td> <td><asp:DropDownList runat="server" id="CountryListBox" AppendDataBoundItems="True" DataSourceID="CountrySqlDataSource" DataTextField="location" DataValueField="location" AutoPostBack="True" > <asp:ListItem Selected="True" >(Show All)</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td style="width: 70px"> Skills</td> <td><asp:TextBox runat="server" id="LastNameTextBox" Text="*" /></td> </tr> <tr> <td style="width: 70px"></td> <td><asp:Button runat="server" id="FilterButton" Text="Filter Results" /></td> </tr> </table> </td> <td valign="top" style="width: 587px; height: 162px;"> <asp:GridView ID="EmployeesGridView" DataSourceID="SqlDataSource2" DataKeyNames="employeeID" AutoGenerateColumns="False" AllowSort="True" RunAt="server" Height="143px"> <HeaderStyle backcolor="Navy" forecolor="White"/> <RowStyle backcolor="White"/> <AlternatingRowStyle backcolor="LightGray"/> <EditRowStyle backcolor="LightCyan"/> <Columns> <asp:BoundField DataField="employeeID" HeaderText="employeeID" ReadOnly="True" SortExpression="employeeID" /> <asp:BoundField DataField="employeeName" HeaderText="employeeName" SortExpression="employeeName" /> <asp:BoundField DataField="companyName" HeaderText="companyName" SortExpression="companyName" /> <asp:BoundField DataField="jobSkills" HeaderText="jobSkills" SortExpression="jobSkills" /> <asp:BoundField DataField="experiance" HeaderText="experiance" SortExpression="experiance" /> <asp:BoundField DataField="location" HeaderText="location" SortExpression="location" /> </Columns> </asp:GridView> </td> </tr> </table> <asp:SqlDataSource ID="CountrySqlDataSource" SelectCommand="SELECT DISTINCT location FROM tlbEmployee" EnableCaching="True" CacheDuration="60" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" RunAt="server" /> <asp:SqlDataSource ID="EmployeeDetailsSqlDataSource" SelectCommand="SELECT * FROM [tlbEmployee] WHERE (([location] LIKE '%' + @location + '%') AND ([jobSkills] LIKE '%' + @jobSkills + '%'))" EnableCaching="True" CacheDuration="60" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" FilterExpression="location LIKE '{0}' AND jobSkills LIKE '{1}'" RunAt="server"> <FilterParameters> <asp:ControlParameter ControlID="CountryListBox" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="LastNameTextBox" PropertyName="Text" /> </FilterParameters> <SelectParameters> <asp:ControlParameter ControlID="CountryListBox" Name="location" PropertyName="SelectedValue" Type="String" /> <asp:ControlParameter ControlID="LastNameTextBox" Name="jobSkills" PropertyName="Text" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT DISTINCT location FROM tlbEmployee"></asp:SqlDataSource> </div> <asp:SqlDataSource ID="SqlDataSource2" runat="server"></asp:SqlDataSource> </form></body></html>
View 1 Replies View RelatedHello all! How can I get data from SqlDataSource for row selected in GridView?
View 3 Replies View RelatedHello all,I have what I think should be a simple problem to solve but I just don't quite understand what to do (.NET Framework Developer Center confused me :( ).My code should load the highest SiteID, known as Last_ID into the siteIdBox when the form is in insert mode. My difficulty is in understanding how to use the sqlDataSource correctly. Dim dsLastId As New SqlDataSource() Dim siteIdBox As TextBox Dim dsmLastId As SqlDataSourceMode If FV_Site.CurrentMode = FormViewMode.Insert Then Try
dsLastId.ConnectionString = ConfigurationManager.ConnectionStrings("AquaConnectionString1").ToString dsLastId.SelectCommandType = SqlDataSourceCommandType.Text dsLastId.SelectCommand = "SELECT MAX(Site_ID) AS Last_ID FROM Tbl_Site"
dsmLastId = SqlDataSourceMode.DataReader
siteIdBox.Text = dsmLastId.?????
Finally
dsLastId = Nothing End Try End If If anyone could tell me the code for getting the value from the select statement into the textbox, I would be most grateful.Thank you, m00sie.
I have a process that inserts a new record using the InsertCommand of a SqlDataSource. As part of the process, I need to insert data the is available in a different SqlDataSource. I was trying this with the Insert Parameter:
View 1 Replies View Related[I am new to asp.net]
Assume I have a databse for "products"; product id is a primary key.
Here is what I am trying to:
1. DetailsView for a product (eg id = 1110) (I got this far)
2. how can I list other products starting with 111x id
3. I also to show them on same page as 1110 as "parent" 111x as children
Thanks,
Background:I am using Visual Studio 2005 Standard SP1 to create an ASP.NET website that accesses an SQL 2005 database. I am using vb.net as well.I am passing an ID in a query string from one page to the next, where I retrieve it using an SQLDataSource. The data will only be one row; it is returning customer information.Problem:I need to be able to get specific fields from the SQLDataSource and populate some textboxes. Honestly, I'm not really sure where to begin. For the sake of argument, let's say that I am working with this:'My TextboxDim LastName As Textbox'My SQLDataSource (filtered by query string using the customer's ID to only get 1 customer's information at a time)SQLDataQuestion:So, how would I go about retrieving the lastname field from SQLData and inserting it into the textbox LastName?Thanks, J'Tok
View 2 Replies View Related1st of all i'm using 3.5 and c#.
On my page I have 2 sqldatasource controls. sds1 and sds2
In my select statement of sds2 how do I make a select parameter based on a value or column I return from sds1? And please don't tell me to join my sds2 select in sds1, I don't want to do that. I need two seperate sds.
Hello, every one! This is my first post on the forum. I got some questions about caching data with SqlDataSource controls in asp.net 2005. Here are them: According to the vs.net 2005 documents, SqlDataSource controls will sustain an individual cache for each combination of ConnectionString, SelectCommand and values of SelectParameters. But how about FilterExpression and FilterParameters? If I enable caching and change the FilterExpression or values of FilterParameters, will the SelectCommand be reexcuted, or will the databinding controls just get data from the existing cache? And will multiple SqlDataSource controls with the same combination of ConnectionString, SelectCommand and values of SelectParameters share a common cache, or sustain caches of their own?
View 1 Replies View RelatedI am using a drap and drop SQLDataSource control. Everything works like I am wanting it to, but I want to check a value from one of the fields that I have retrieved. I am lost as how to retreive just the field. If I have to create another dataset to do the work what is the point of using the drag and drop control? I would really like to just access the dataset fields as needed.
View 2 Replies View RelatedHello...Can someone help me?I´m getting info of a product via sqldatasource in this way:<asp:SqlDataSource ID="myData" runat="server" ConnectionString="..." SelectCommand="spGetProduct" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:QueryStringParameter Name="Id" QueryStringField="Id" Type="String" /> </SelectParameters></asp:SqlDataSource>In my ASPX page I get the data in this way:<asp:Repeater ID="repProduct" runat="server" DataSourceID="myData"> <ItemTemplate> <p><%# Eval ( "ProductName") %></p> </ItemTemplate></asp:Repeater> My problem is in my code behind because I need some data from this DataSource.For example, I want the Product Name as the page title. So the question is how I get something like this in my code behind:protected void Page_Load ( object sender, EventArgs e ){ this.Page.Title = Eval ( "ProductName") ;}Thanks!
View 2 Replies View RelatedHi, I don't know if i's a silly question.
Now I want to get data from sqldatasource by only write some code,I don't know without creat some data control components if it can be true?
If it can do,how can I write the codes?
Especially I don't know how to write the code witch can "read" data.