Changing SelectMethod In SQLDataSource
Aug 21, 2006
I have a gridview bound to an ObjectDataSource, which is a dataset populated by SQL queries. The gridview works with the default SelectMethod configured in the ObjectDataSource. I would like to be able to change the SelectMethod based on user input, which would call a different query. I have one textbox for input and several buttons to pick the type of filter.
My gridview populates on with the default selectmethod if I create a button that does nothing but a postback. My other buttons run the following codes which returns nothing. Any ideas what I'm doing wrong?
If e.CommandArgument = "Last_Name" Then
EmployeeData.SelectMethod = "GetDataByLastName"
End If
If e.CommandArgument = "First_Name" Then
EmployeeData.SelectMethod = "GetDataByFirstName"
End If
gvPhoto.DataSourceID = EmployeeData.ID
gvPhoto.DataBind()
Thanks.
Lisa
View 1 Replies
ADVERTISEMENT
May 19, 2008
I cant seen to change the Select command for a SQL Datasourcetry #1 SqlDataSourceProfilesThatMatch.SelectCommand = strSQLForSearch SqlDataSourceProfilesThatMatch.SelectParameters("ProfileID").DefaultValue = pProfileID SqlDataSourceProfilesThatMatch.SelectParameters("LoggedInUsersZipcode").DefaultValue = pUsersZipCode SqlDataSourceProfilesThatMatch.SelectParameters("ZipDistance").DefaultValue = pDistance
NewProfilesThatMatchGridView.DataBind()
try #2 SqlDataSourceProfilesToBeMatched.SelectParameters.Clear() SqlDataSourceProfilesThatMatch.SelectCommand = strSQLForSearch SqlDataSourceProfilesThatMatch.SelectParameters.Add("ProfileID", pProfileID) SqlDataSourceProfilesThatMatch.SelectParameters.Add("LoggedInUsersZipcode", pUsersZipCode) SqlDataSourceProfilesThatMatch.SelectParameters.Add("ZipDistance", pDistance)
NewProfilesThatMatchGridView.DataBind()
No errors but no rows show in the gridview. If I debug and get the value strSQLForSearch and paste it into a new SQL query window I get results.
Any ideas????
Thanks
View 3 Replies
View Related
Aug 29, 2007
I have one page, one connection, and three dropdowns. The connection looks like (as an example):<asp:SqlDataSource ID="DropDownConn" runat="server" ConnectionString="<%$ ConnectionStrings:aousConnectionString %>" SelectCommand="SELECT [Value], [Text] FROM [DropDown] WHERE (([Group] = @Group) AND ([Viewable] = @Viewable))"> <SelectParameters> <asp:Parameter Name="Group" Type="String" /> <asp:Parameter DefaultValue="True" Name="Viewable" Type="Boolean" /> </SelectParameters></asp:SqlDataSource>
The DropDowns Look like this:
<asp:DropDownList ID="DropDown1" runat="server"></asp:DropDownList><asp:DropDownList ID="DropDown2" runat="server"></asp:DropDownList><asp:DropDownList ID="DropDown3" runat="server"></asp:DropDownList>The C# Code I am trying is like this:DropDownConn.SelectParameters["Group"].Equals("DropDown1");DropDownConn.SelectParameters["Viewable"].Equals(true);DropDown1.DataSourceID = "DropDownConn";DropDown1.DataTextField = "Text";DropDown1.DataValueField = "Value";DropDown1.DataBind();
As an example. I can not get it done so that I don't have to create 3 dataconnections. Any help, PLEASE?
View 2 Replies
View Related
Jul 23, 2007
What is the C# code I use to do this?
I'm guessing it should be fairly simple, as there is only one row selected. I just need to pull out a specific field from that row and then insert that value into a different SqlDataSource.
View 7 Replies
View Related
Mar 8, 2007
i am using visual web developer 2005 with SQL Express 2005 with VB as the code behindi have one database and three tables in itfor manipulating each table i am using separate SqlDataSource() is it sufficient to use one SqlDataSource() for manipulating all the three tables ? i am manipulating all the tables in the same page only please help me
View 1 Replies
View Related
Dec 14, 2000
A college forgot to change the data root when installing a developer server. My question is can this be changed whitout reinstalling the server and restoring the developer databases.
I found sqldataroot under [HKEY_LOCAL_MACHINESoftwareMicrosoftMSSQLServerSetu pSQLDataRoot]
If I stop the sql server and change this value and move the *.mdb and *.ldf files. Would I risk currupting the databases and do I need to change something else? For example would changeing this value change the default path for backupdevices?
View 2 Replies
View Related
Dec 5, 2000
I have a problem where our developers would like to change the passwords of the SQL Logins without knowing the users old password.
The only way they can use the below syntax is that they must be a member of the SYSAdmin Server Role.
sp_password NULL, 'newpassword',Max
I need a way to allow them to change the passwords without making a user a member of the SYSAdmin Server Role.
Any thoughts would be greatly apprecitated. Thanks in advance.
Max
View 1 Replies
View Related
Dec 20, 2000
I need to change my security settings from "Windows NT Only" to "SQL Server and Windows NT". Does anyone know of any issues with doing this? Does this subtract anything or does it only add access??
View 1 Replies
View Related
Jun 5, 2002
Is there a way to change the license key after installation of SQL7.0?
View 1 Replies
View Related
Nov 19, 2002
hi, I have created a database in sql server 2000. I need to duplicate the database under different name, how can I do that?
Also, can I rename a database name?
thanks
Ali
View 3 Replies
View Related
Dec 7, 1999
Hi all,
I need to change the NT Server computer name (and the SQL Server name). I know how to do it in NT, but how would I go about changing the SQL Server name. Can anyone help me with this? Is this an easy process?
Thanks,
LC
View 3 Replies
View Related
Mar 1, 2005
Someone is changing permissions on our production sql databases frequently which is causing big problems..any idea how to know who is changing and when? Any code that can be written to capture such activity?
thanks,
dbfan.
View 6 Replies
View Related
Aug 6, 1998
I`m running SQL 6.5 with standard security. We`re running NT 4.0. I am a member of the NT Admin group - which, of course, has sa privileges in SQL Server. I changed the sa password (via Enterpise Manager on my client machine); and it worked. I tested the password change by connecting to ISQL/w - both on my client machine and at the server machine.
However, when I attempted to connect to the server via Enterprise Manager (SEM) - on my client machine - my login attempt failed. But at the server machine, I connected just fine.
Somehow, even though we`re using standard security, I`m getting locked out of SEM because of the new password. Changing the sa password back to what it had been resolved the problem; but the old password was only meant to be temporary.
Any suggestions or explanations?
View 3 Replies
View Related
Dec 15, 1998
Hi,
During SQL installation I left the SA password blank. Now when I try to change it, the event log fills up with the following errors:
Mesg 18456 : Login failed- User: sa.
I am using SQL database for SMS and I have a SMS service account.
The error type in event viewer is "Failure Audit".
I am stopping and starting SQL once changes are made. I am also registering server with "Use Trusted Connection". I have also tried with "Use Standard Security" and the SA account.
Can anyone tell me how to change my SA password without affecting my SMS service account?
Thanks,
Terry
View 1 Replies
View Related
Nov 9, 2004
Hi all,
I have a table that has integrity constraints in place and it is populated with the data. I need to rename one of the columns in the table. I am hesitant to use sp_rename procedure because when I used it before I get a warning message that says "changing any part of an object name could break scriptd and stored procedure." how big of a problem is it? Is there any other way to do it without hearting anything? Thanks.
View 1 Replies
View Related
Nov 30, 2005
How can you change a Column name for MS SQL 2000 ?
something like :
ALTER TABLE [dbo].[MyTable]
OldName RENAME NewName
GO
thank you
View 6 Replies
View Related
Mar 2, 2006
I have looked thru the forum but have a couple of questions:
1) data base was created with case insensitive collation
2) all the tables were then create (72 tables) and by default got the CI collation on all columns
3) lots of data was added 2GB
4) discovered mistake and altered the database to have case sensitive collation
5)..... how to change all the collations for all the columns without doing them all manually
can i backup the database and change some settings and restore it?
export all the data, drop and recreate tables and import data?
????
View 7 Replies
View Related
Aug 9, 2006
We are building an inventory management system complete with BOM. It is important to track what employee is updating what tables. Currently all such tables have a Date field that is updated when a change is made, and an EmployeeID field which records the employee making the change. I am wondering if someone knows of a better way to track this information. Any suggestions?
View 4 Replies
View Related
Apr 25, 2007
Hey guys,
I have a file that has date formatted like so: 2006-11-16 20:12:00
I would like the dateformat to be like mm/dd/yyy hh:mm
The file is being pulled into a varchar field..... as 2006-11-16 20:12:00
when I do a conversion i can only get it to mon 11,2006
any suggestions
View 1 Replies
View Related
Apr 21, 2008
Finally, I may have a good enough excuse to justify changing the compatabilty level of one of the biggies I look after!
Before I go ahead with the change I just wanted to run a couple of questions passed the community.
I know this is very vague, but what sort of problems should I expect? I know there are a few syntax changes, but I don't imagine I will have a problem going up in compatability level!
What is the best method to perform this?
A very simple
EXEC sp_dbcmptlevel 'playdb', 80
Or
ALTER DATABASE SET SINGLE_USER
EXEC sp_dbcmptlevel 'playdb', 80
ALTER DATABASE SET MULTI_USER
How long does this process take; are we talking seconds, minutes, hours? I imagine it's seconds, but I pose this question because a colleague reckons it will take longer because of the database size. I argue that because it's a db configuration setting, it will make no difference...
Thanks a bunch,
George
View 14 Replies
View Related
Jan 25, 2012
SO, If I had a problem with server computer date & stored false dates for some operations, How can I alter those dates to correct dates.
View 1 Replies
View Related
Jan 29, 2004
Hi. Sorry to be asking this. I know there is a KB article with the steps for changing a SQL2K server name, but I can't find it for the life of me.
Anyone have it tagged?
TIA
View 3 Replies
View Related
Oct 8, 2015
We are going to install new SQL Server 2014 on Windows 2012 R2. There is a copy of this server which is running on SQL Server 2005. This one has old operating system and wont be able upgrade to SQL Server 2014.
After doing some checks on 2014 we would like to change this server-name with the old server-name which is running on 2005.how can we change the server-name?
View 4 Replies
View Related
Jun 17, 2008
Hi Experts,
Can someone help me in knowing what is the impact if I happens to change the name of the computer / name of the Server name.
Thanks in advance
View 1 Replies
View Related
Feb 27, 2014
I have the following field “Period_DT” displayed as “2012-12-01” how can i make it ‘2012-12-01 00:00:00’
Column Name : Period_DT
Date type : Date
View 2 Replies
View Related
Jun 5, 2006
Bob writes "I want to change the value of a field but it is part of a
unique index. Can someone help me do this.
I need to update about 55000 rows.
thank you very much."
View 2 Replies
View Related
Jun 6, 2006
Hi!
I have a database in SQL Server 2005 Express edition in standard collation. And now I need to store data including letter "è" (I'm from Slovenia). Can please someone tell me how to change the collation in server and database, please?
Thanks in advanced,
d
View 7 Replies
View Related
Jan 24, 2007
I have read all the FAQs on restore and find myself still confused.
So I apologize if the information is there and I am missing it.
I want to move the databases from an old server to a new server, brand new, will be the same name and IP address once the database is transfered.
Everything I have read says do a full back up and then restore onto the new server. Makes sense so far, my question is how does the Database Master get handled?
Is it necessary to restore it?
If so what is the best way to go about it?
Thanks for your help
View 12 Replies
View Related
Mar 27, 2007
Is there a thread that says what should we be looking for if I change password for SA?
I am new to the org here and have to clamp down on the SA logins.
This is what comes to my mind:
1.Client apps:
====================
a.Hard coded into VB apps
b.File DSNs
c.System DSNs
2.Web app:
================
a.Hard coded into .asp and .aspx
b..inc files that have collective connection strings.
c.Possible use of file DSNs
d.Possibly use of system DSNs
3.Ad-hoc Queries by Users
===============================
4.Maintenance Plans and Jobs etc.
=======================================
a. DTS packages
b. Replication
Is there anything else that you can add to this list will be helpful.
Regards
Paresh
Regards
Paresh Motiwala
Boston, USA
View 4 Replies
View Related
Jun 1, 2007
Hi All,
If the column names are changed , is there are a easy way to change the referred columns in the SP's. What I am doing is going into each SP and replace the old name with the new name.
Thank you for any help on this.
Necessity is the mother of all inventions!
View 18 Replies
View Related
Jun 9, 2007
Is there any strategy I should follow in order to change the SA password.Experts answers only. Thanks
=============================
http://www.sqlserverstudy.com
View 20 Replies
View Related
Aug 14, 2007
I changed the UID before migrating in the DTS and then migrated it but after Migrating the UID was as it was earlier in the DTS and was not the changed one ....
I am unaable to find out how it is happening ???
anybody having a clue to it ...
please shed some light
View 6 Replies
View Related
Oct 5, 2007
After I have changed the SA password and attempt to login I get the following error.
A connection was successfully established with the server, but then an error occurred during the login process. (provider:Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error:233)
If I change the password back I can login without any problems. I need to change the SA password.
Thanks for any suggestions.
View 6 Replies
View Related