Checkbox Only Records Value Of 1 To DB Table
Apr 29, 2008
<asp:CheckBox ID="chkName" Checked='<%#Bind("FirstName_Disp")%>' runat="server" />
<asp:SqlDataSource ID="srcProfile" runat="server" ConnectionString="<%$ ConnectionStrings:webConn %>"
SelectCommand="sp_Profile_Get" SelectCommandType="StoredProcedure"
DeleteCommand="sp_Profile_Delete" DeleteCommandType="StoredProcedure"
UpdateCommand="sp_Profile_Update" UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="UserID" SessionField="NewUserID" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="UserID" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="UserID" />
****
<asp:Parameter Name="Name_Disp" Type="Byte" />
****</UpdateParameters>
</asp:SqlDataSource>
ALTER PROCEDURE dbo.sp_Profile_Update
@UserID uniqueidentifier,
****
@Email_Disp tinyint
****
AS
UPDATE [tbl****]
SET ****
Email_Disp = @Email_Disp
****
WHERE UserID = CONVERT(uniqueidentifier,@UserID)
Above is a sample of a checkbox that users on my site can check/uncheck so that certain information will/will not display to other users. However, the only value that writes to the DB table--depending if it is checked or unchecked--is a 1 (checked). In a previous iteration of the page, it worked so I know it can be done but I didn't save the method. Any suggestions?
View 11 Replies
ADVERTISEMENT
Mar 7, 2008
Hello
I need to make a webpage that stores the name, email, ... from the user into a database. The user also checks several checkboxes to register for some items. That last one gives me some trouble. Inside my code the checkbox-value is stored into a Boolean (true of false). On the sql-server I declared my field as a Bit (0 or 1).
1 public string Input_inschrijving(cls_inschrijving nieuwe_inschrijving) {
2
3
4
5 inschrijving_cn = new SqlConnection("Data Source=serverIp;Persist Security Info=True;User ID=DBname;Password=mypasword");
6
7
8
9 string stUser = "INSERT INTO tbl_inschrijving (naam, voornaam, straat, nr, postcode, woonplaats, telefoon, email, functie, organisatie, ostraat, onr, opostcode, owoonplaats, otelefoon, oemail, ws1, ws2, ws3, ws4, ws5, ws6, ws7, ws8, ws9, ws10, ws11, ws12) VALUES ('" + m_naam + "', '" + m_voornaam + "', '" + m_straat + "', '" + m_nr + "', '" + m_postcode + "', '" + m_woonplaats + "', '" + m_telefoon + "', '" + m_email + "', '" + m_functie + "', '" + m_organisatie + "', '" + m_ostraat + "', '" + m_onr + "', '" + m_opostcode + "', '" + m_owoonplaats + "', '" + m_otelefoon + "', '" + m_oemail + "', " + m_ws1 + " , " + m_ws2 + " , " + m_ws3 + " , " + m_ws4 + " , " + m_ws5 + " , " + m_ws6 + " , " + m_ws7 + " , " + m_ws8 + " , " + m_ws9 + " , " + m_ws10 + " , " + m_ws11 + " , " + m_ws12 + ")";
10
11
12
13 cm = new SqlCommand(stUser, inschrijving_cn);
14
15
16
17 try
18
19 {
20
21 inschrijving_cn.Open();
22
23 dr = cm.ExecuteReader();
24
25 dr.Close();
26
27 inschrijving_cn.Close();
28
29 return "Your registration was succesfull!";
30
31
32
33 }
34
35 catch(SqlException sx) {
36
37 return "Error!" + sx.Message;
38
39 }
40
41 }
42
Inside the table tbl_inschrijving on the SQL-server, i declared the checkbox values ws1, ws2, ws3, ... to a bit with length 1 (nulls allowed)How can I store the boolean-value into my table? I tried to change several declarations (int, char, varchar...) nothing works.
View 3 Replies
View Related
Sep 13, 2006
Ok, I'm really new at this, but I am looking for a way to automatically insert new records into tables. I have one primary table with a primary key id that is automatically generated on insert and 3 other tables that have foreign keys pointing to the primary key. Is there a way to automatically create new records in the foreign tables that will have the new id? Would this be a job for a trigger, stored procedure? I admit I haven't studied up on those yet--I am learning things as I need them. Thanks.
View 4 Replies
View Related
Aug 11, 2015
Table1 contains fields Groupid, UserName,Category, Dimension
Table2 contains fields Group, Name,Category, Dimension (Group and Name are not in Table1)
So basically I need to read the records in Table1 using Groupid and each time there is a Groupid then select records from Table2 where Table2.Category in (Select Catergory from Table1)
and Table2.Dimension in (Select Dimension from Table1)
In Table1 There might be 10 Groupid records all of which are different.
View 9 Replies
View Related
Oct 21, 2015
I am trying to write a query that will retrieve all students of a particular class and also any rows in HomeworkLogLine if they exist (but return null if there is no row). I thought this should be a relatively simple LEFT join but I've tried every possible combination of joins but it's not working.
SELECT
Student.StudentSurname + ', ' + Student.StudentForename AS Fullname,
HomeworkLogLine.HomeworkLogLineTimestamp,
HomeworkLog.HomeworkLogDescription,
ROW_NUMBER() OVER (PARTITION BY HomeworkLogLine.HomeworkLogLineStudentID ORDER BY
[Code] ...
It's only returning two rows (the students where they have a row in the HomeworkLogLine table).
View 3 Replies
View Related
Jul 20, 2005
I can't get my head around this:I want to select all IDs from table A that do not have a related record intable B according to some condition:Table A contains, say, Parents and table B contains Children. I want toselect all Parents that have no children called "Sally" (this is a noddyexample, reminds me of being at Uni again :) ).Any ideas?Thanks
View 2 Replies
View Related
Mar 18, 2014
I have a situation where deleting old records is blocking updating latest records on highly transactional table and getting timeout errors from application.
In details, I have one table called Tran_table1 in OLTP database. This Tran_table1 is highly transactional table, it will receive data for insert/update continuously
While archiving 2 years old records from Tran_table1 into Tran_table1_archive in batches(using DELETE OUTPUT INTO clause), if there is any UPDATEs on Tran_table1,these updates are getting blocked and result is timeout errors in application.
Is there any SQL Server hints to avoid blocking ..
View 3 Replies
View Related
Dec 3, 2014
I have a table with about half a million records, each representing a patient in my county.
Each record has a field (RRank) which basically sorts the patients as to how "unwell" they are according to a previously-applied algorithm. The most unwell patient has an RRank of 1, the next-most unwell has RRank=2 etc.
I have just deleted several hundred records (which relate to patients now deceased) from the table, thereby leaving gaps in the RRank sequence. I want to renumber the remaining recs to get rid of the gaps.
I can see what I want to accomplish by using ROW_NUMBER, thus:
SELECT ROW_NUMBER() Over (ORDER BY RRank) as RecNumber, RRank
FROM RPL
ORDER BY RRank
I see the numbers in the RecNumber column falling behind the RRank as I scan down the results
My question is: How to convert this into an UPDATE statement? I had hoped that I could do something like:
UPDATE RISC_PatientList_TEMP
SET RRank = ROW_NUMBER() Over (ORDER BY RRank);
but the system informs that window functions will only work on SELECT (which UPDATE isn't) or ORDER BY (which I can't legally add).
View 5 Replies
View Related
Jul 20, 2005
I have been searching many postings and I cant seem to find anyonethat has this answer so I decided to post. I am using SQL(Transact-SQL).If I have 2 tables with columnsacct_num,activity_date,and pay_amt and I want to delete one instanceof a record in table 1 for every instance of that record in table 2how could I do that. For example.Table 1-----------acct activity_date pay_amt123 5/1/2004 50.00123 5/1/2004 50.00123 5/1/2004 50.00123 5/1/2004 50.00123 5/1/2004 50.00Table 2-----------acct activity_date pay_amt123 5/1/2004 50.00123 5/1/2004 50.00I need a delete statement that will find 2 of the 5 records(It doesn'tmatter which 2) and delete them.Leaving table one looking like this.Table 1-----------acct activity_date pay_amt123 5/1/2004 50.00123 5/1/2004 50.00123 5/1/2004 50.00How can I do this??
View 7 Replies
View Related
Jun 2, 2004
Hi,
Even this question is not related to this forum but may be some one help me.
I have a master detail form. I want to delete record but only those record that user click with checkbox. There is no field like boolean. How can I make a scenerio about adding an unbound checkbox in detail form and how would i link with rows in detail sub form.
any help will be highly appreciated.
Regards,
View 2 Replies
View Related
Apr 16, 2004
Hi,
I have a dynamical query to select the data from my sql db.
Everything works fine except the checkboxes.
Since the values in the db table are stored in booleans (BIT) field and I am using the a string builder to generate the sql query, I am stucked.
How can I solve this problem?
My stringbuilder works roughly like:
string XRealtime = ckbReal.Checked.ToString();
XRealtime = (XRealtime !="False" ? "Main.Realtimedata = '" + XRealtime + "'": "");
System.Text.StringBuilder query = new System.Text.StringBuilder();
query.Append("SELECT * From Main Where");
...
query.Append(XRealtime);
query.Append((XRealtime !="" ? " AND " : ""));
...
Thank you in advance...
Gorginio
View 1 Replies
View Related
Feb 2, 2006
hello all i have a 2 questions hope that u can help me my first question is: in ms access there was a data type named yes/no and it was a checkbox is there a checkbox data type in sql server 2005?
my second question is i need the connection code between asp.net 2005 and sql server 2005 i searched in here for that code but i got more confuse i found two codes and both are not working so hope u can give me the right connecting code. that's all thanks
View 11 Replies
View Related
Feb 8, 2007
Hi all,
I'm using the NULL checkbox in a report. Is it possible to change the diplayed name 'NULL' in a different name. The user will not see 'NULL' but something else.
Is that possible??
Greetz
View 3 Replies
View Related
Jan 30, 2008
Hi All,
I have a database table with a bit field. In my .aspx page I have a checkbox that is checked by default. My SqlDataSource is set up like so:
InsertCommand="INSERT INTO Studies (Study_Name, Study_Status) VALUES (@StudyName, @StudyStatus)"> <InsertParameters> <asp:ControlParameter ControlID="txtStudyName" Name="StudyName" PropertyName="Text" Type="String"/> <asp:ControlParameter ControlID="chkboxStudyStatus" Name="StudyStatus" PropertyName="Text" Type="Boolean"/>
I'm getting an error when inserting.
Error: Cannot insert the value NULL into column 'Study_Status', table 'Studies'; column does not allow nulls. INSERT fails. The statement has been terminated.
View 2 Replies
View Related
May 12, 2008
I have a form set-up and am trying to add multiple items in my checkbox to the database; however, the only thing added to the database is the first item checked. Here is the code and any help will be greatly appreciated. Thank you!:<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConConnectionString %>" InsertCommand="INSERT INTO Consultations(FullName, Email, Business, BusinessInfo, Services, Comments) VALUES (@FullName, @Email, @Business, @BusinessInfo, @Services, @Comments)"
SelectCommand="SELECT Consultations.* FROM Consultations">
<InsertParameters>
<asp:ControlParameter Name="FullName" Type="String" ControlId="fullname" PropertyName="Text" />
<asp:ControlParameter Name="Email" Type="String" ControlId="emailTextBox" PropertyName="Text" />
<asp:ControlParameter Name="Business" Type="String" ControlId="bisDropDownList" PropertyName="SelectedValue" />
<asp:ControlParameter Name="BusinessInfo" Type="String" ControlId="businessTextBox" PropertyName="Text" />
<asp:ControlParameter Name="Services" Type="String" ControlID="checkboxlist" PropertyName="SelectedValue" />
<asp:ControlParameter Name="Comments" Type="String" ControlID="commentsTextBox" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>
View 3 Replies
View Related
Dec 14, 2006
All,
When creating a dynamic parameter list from a query, Reporting Services graciously provides a "(Select All)" checkbox. How can I select this checkbox by default so that when a user generates the report, all of the values are selected?
Thanks
View 7 Replies
View Related
Aug 24, 2006
Hi there,
I am using SQL Server 2005 Reporting Services. Right now, I have a textbox with 0 or 1 values in my report and I want to show a checkbox: checked for value 1 and uncheck for 0. Is there anyway to add a checkbox in the report?
Thanks in advance.
semaj
View 5 Replies
View Related
Oct 18, 2007
Hi !
I have a problem,i have two reports in first report i shwo names of employers and in the second i show names of their employees and i've linked these reports with navigation but there is a problem becuse i want to show details of two or three rows together in second report,and i want to have check box for this,i need to use check box in preview mode in reporting services.How to have check box to select two or three employers ?
Thanks alot.
SHIARM
View 11 Replies
View Related
Jan 15, 2008
Hi,
I have a order form and i want to take it to the next level.. So i have a report in my reportserver is exceuted using a sproc. I am using an Report viewer to view the report in my web application.
So is it possible to have 2 - 3 check boxes that will populate thru the webapplication, in my report viewer and still use the report from the report server.. For eg.
The data in my report will looks like this
OrderNo PlanId PlanName ... ETc
chkbox 45 15 ABD
chkbox 46 75 BDA
any help will be appreciated.
Regards
Karen
View 4 Replies
View Related
Aug 19, 2006
In SQL Server 2000, I have a parent table with a cascade update to a child table. I want to add a record to the child table whenever I add a table to the parent table. Thanks
View 1 Replies
View Related
Apr 29, 2014
I have table 'stores' that has 3 columns (storeid, article, doc), I have a second table 'allstores' that has 3 columns(storeid(always 'ALL'), article, doc). The stores table's storeid column will have a stores id, then will have multiple articles, and docs. The 'allstores' table will have 'all' in the store for every article and doc combination. This table is like the master lookup table for all possible article and doc combinations. The 'stores' table will have the actual article and doc per storeid.
What I am wanting to pull is all article, doc combinations that exist in the 'allstores' table, but do not exist in the 'stores' table, per storeid. So if the article/doc combination exists in the 'allstores' table and in the 'stores' table for storeid of 50 does not use that combination, but store 51 does, I want the output of storeid 50, and what combination does not exist for that storeid. I will try this example:
'allstores' 'Stores'
storeid doc article storeid doc article
ALL 0010 001 101 0010 001
ALL 0010 002 101 0010 002
ALL 0011 001 102 0011 002
ALL 0011 002
So I want the query to pull the one from 'allstores' that does not exist in 'stores' which in this case would the 3rd record "ALL 0011 001".
View 7 Replies
View Related
Feb 13, 2008
I have two tables that share a common identity row. I need to build a query where data that exists in one table does not contain data in the other table. For example, table 1 has columns of Owner_ID, LastName, FirstName and table 2 has columns Auto_ID, Owner_ID, AutoMake. Both tables are joined by the Owner_ID column. I need a query that provides all owners from table 1 who do not have an entry in table 2.
Thanks in advance,
Mark
View 5 Replies
View Related
Nov 19, 2015
There are 3 tables Property , PropertyExternalReference , PropertyAssesmentValuation which are common for 60 business rule
SELECT
PE.PropertyExternalReferenceValue [BAReferenceNumber]
, PA.DescriptionCode
[PSDCode]
, PV.ValuationEffectiveDate
[EffectiveDate]
, PV.PropertyListAlterationDate
[ListAlterationDate]
[code]....
Can we push the data for the above query in a physical table and create index to make the query fast rather than using the same set tables multiple times
View 11 Replies
View Related
Jun 29, 2015
I need to delete records from a table (Table1) which has a foreign key column in a related table (Table2).
Table1 columns are: table1Id; Name. Table2 columns include Table2.table1Id which is the foreign key to Table1.
What is the syntax to delete records from Table1 using Table1.Name='some name' and remove any records in Table2 that have Table2.table1Id equal to Table1.table1Id?
View 11 Replies
View Related
Jul 24, 2006
hi I have a bit field in sql server represented by a checkbox ... I am updating the database in code ( ie not using formview generated update .. ) the line that is falling over is .Parameters.Add("@archive", SqlDbType.Bit).Value = txtarchive.Checkedit falls over saying failed to convert string parameter to boolean the
value of txtarchive.checked is either true or false - how do i convert
this to 1 or 0 or something that sql is happy with ... thanks
View 2 Replies
View Related
Mar 19, 2008
Hi i am trying to store the checkbox values on my page to the database, but im stuck on what to do. I have the following code already;protected void Btn_Subscribe_Click(object sender, EventArgs e)
{SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString);
string strSQL = "INSERT INTO Newsletter(emailAddress) VALUES (@emailAddress)";SqlCommand Command = new SqlCommand(strSQL, conn);
Command.Parameters.Add("@emailAddress", SqlDbType.VarChar);Command.Parameters["@emailAddress"].Value = txtEmail.Text;
conn.Open();
Command.ExecuteNonQuery();
conn.Close();
}
How do i now insert the values from my checkbox, this is how i am setting the checkbox;public void Page_Load(object sender, EventArgs e)
{ArrayList values;if(!IsPostBack)
{
//Build array of data to bind to checkboxlistvalues = new ArrayList();
values.Add("Sport");values.Add("Gardening");values.Add("technology");
AlertList.DataSource = values;
AlertList.DataBind();
}
If i am going about it the wrong way please let me know, thanks
View 15 Replies
View Related
May 21, 2008
The following checkbox in my FormView only records "True" to the database, even after the checkbox is unchecked. After exhausting searches for many weeks, I'm in desperate need of a resolution and would very much appreciate your expertise. From what I understand, the #Bind feature is supposed to be a 2-way binding but I don't know why it doesn't work with my checkbox controls. I know that I should use AutoPostBack="True", but when I do so, I get the error "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
<asp:UpdatePanel ID="udp1" UpdateMode="Conditional" runat="server"> <ContentTemplate> <asp:CheckBox ID="chkEmail" Text="Display?" TextAlign="left" Checked='<%#Bind("Email_Disp")%>' runat="server" /><br /> </ContentTemplate> </asp:UpdatePanel>
<asp:SqlDataSource ID="srcProfile" runat="server" ConnectionString="<%$ ConnectionStrings:webConn %>"
SelectCommand="sp_Profile_Get" SelectCommandType="StoredProcedure"
DeleteCommand="sp_Profile_Delete" DeleteCommandType="StoredProcedure"
UpdateCommand="sp_Profile_Update" UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="UserID" SessionField="NewUserID" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="UserID" />
[snip]
<asp:Parameter Name="Email_Disp" Type="Boolean" />
[snip]
</UpdateParameters>
</asp:SqlDataSource>
---------From DB table: Email_Disp bit---------
ALTER PROCEDURE dbo.sp_Profile_Get
@UserID uniqueidentifierAS SELECT *
FROM [myTable] WHERE UserID = CONVERT(uniqueidentifier,@UserID)
---------
ALTER PROCEDURE dbo.sp_Profile_Update @UserID uniqueidentifier,[snip] @Email_Disp bit,[snip]
ASUPDATE [myTable] SET [snip], Email_Disp = @Email_Disp, [snip]WHERE UserID = CONVERT(uniqueidentifier,@UserID)
View 19 Replies
View Related
Aug 15, 2005
Hi there, I've tried googling this (and looking at the many questions on the forum :) but I've not managed to find a decent tutorial / guide that describes a method for using checkboxs to insert true/false flags in a MS SQL db. The db field i'm setting has type set to "bit", is this correct? And secondly (its been a long day!) I just cant figure out the code to assign the bit 1 or 0 / true or false. This is what I've got so far but it's not working........Function InsertProduct(ByVal prod_code As String, ByVal prod_name As String, ByVal prod_desc As String, ByVal prod_size As String, ByVal prod_price As String, ByVal prod_category As String, ByVal aspnet As Boolean) As Integer Dim connectionString As String = "server='server'; user id='sa'; password='msde'; Database='dbLD'" Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString) Dim queryString As String = "INSERT INTO [tbl_LdAllProduct] ([prod_code], [prod_name], [prod_desc], [prod_size], [prod_price], [prod_category],[aspnet]) VALUES (@prod_code, @prod_name, @prod_desc, @prod_size, @prod_price, @prod_category, @aspnet)" Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection) sqlCommand.Parameters.Add("@prod_code", System.Data.SqlDbType.VarChar).Value = prod_code sqlCommand.Parameters.Add("@prod_name", System.Data.SqlDbType.VarChar).Value = prod_name sqlCommand.Parameters.Add("@prod_desc", System.Data.SqlDbType.VarChar).Value = prod_desc sqlCommand.Parameters.Add("@prod_size", System.Data.SqlDbType.VarChar).Value = prod_size sqlCommand.Parameters.Add("@prod_price", System.Data.SqlDbType.VarChar).Value = prod_price sqlCommand.Parameters.Add("@prod_category", System.Data.SqlDbType.VarChar).Value = prod_category If chkAspnet.Checked = True Then sqlCommand.Parameters.Add("@aspnet","1") Else sqlCommand.Parameters.Add("@aspnet","0") End If Dim rowsAffected As Integer = 0 sqlConnection.Open Try rowsAffected = sqlCommand.ExecuteNonQuery Finally sqlConnection.Close End Try Return rowsAffected End Function Sub SubmitBtn_Click(sender As Object, e As EventArgs) If Page.IsValid then InsertProduct(txtCode.Text, txtName.Text, txtDesc.Text, ddSize.SelectedItem.value, ddPrice.SelectedItem.value, ddCategory.SelectedItem.value, aspnet.value) Response.Redirect("ListAllProducts.aspx") End If End SubAny help would be appreciated or links to tutorials.ThanksBen
View 2 Replies
View Related
Mar 2, 2005
Am I correct in finding that there's no checkbox in SQL Server Reporting Services? What other way do you have to display a bit field other than 0-1 ??
View 1 Replies
View Related
Dec 13, 2007
it looks like a multi value parameter is the only kind of parameter that displays a checkbox.
A single checkbox for yes/no parameters are more intuitive to my users than 2 choices from a query.
I tried to set the multi value attribute on such a param but at run time get errors from a couple of places 1) expressions that reference such a parameter, seemingly confused about the value field being allowed to be either an object or an integer 2) unchecking the checkbox causes a prompt demanding that a value be set.
Does anybody have a trick or see what I am missing in trying to make a parameter act like a single yes/no checkbox in just one line of a dropdown parameter list?
View 3 Replies
View Related
Oct 30, 2007
Hello,
I have a report in which one parameter has with multiple selections (List of CheckBoxes). SSRS automatically adds a "Select All" value as the first option. I'm showing a User Type list, but for example, usually the user running the report will be selecting two or three sets of "User Types" (*), then I named those selections and put them in the list also. The list looks like:
"Select All"
IT Users (*)
HR Users (*)
Programmers
DB Analyst... etc...
What I'm trying to do is that when the user selects "IT Users" (per example), then the options "Programmers" and "DB Analyst" will be checked automatically, because they belong to "IT Users" group.
Any help will be appreciated... Thanks in advance
View 2 Replies
View Related
Feb 29, 2008
Hi,
Can anybody help me fetch "True" & "False" value from a CheckBox inside a DataGridView row.
I tried the following code:-
But the cell.Selected doesnot take the correct value.
objGrid = (System.Windows.Forms.DataGridView)controlObj[0];
foreach (DataGridViewRow row in objGrid.Rows)
{
DataGridViewCheckBoxCell cell = row.Cells[0] as DataGridViewCheckBoxCell;
if (cell.Value != cell.FalseValue)
{
if (cell.Selected == true)
{
///Some Code;
}
}
}
Kindly Help ASAP
Thanks
View 4 Replies
View Related
Jan 21, 2008
I'm using an ObjectDataSource in Visual Studio to retrieve records from a SQL Server 2005 database.
I have a very simple dilemma. In a table I have fields FirstName, Surname, Address1, Address2, Address3 etc. None of these are mandatory fields.
It is quite common for the user not to enter data in Address2, Address3, so the values are <null> in the SQL table.
In Visual Studio 2005 I have an aspx form where users can pass search parameters to the ObjectDataSource and the results are returned according to the passed in parameters.
The WHERE clause in my Table Adapter is:WHERE (Address1 LIKE @Address1 + '%') AND (Address2 LIKE @Address2 + '%') AND (Address3 LIKE @Address3 + '%') AND (FirstName LIKE @FirstName + '%') AND (Surname LIKE @Surname + '%')
If, for example, I simply want to search WHERE FirstName LIKE ‘R’, this does not return any results if the value of Address3 is <null>
My query is this: Could someone please show me the best way in Visual Studio 2005 to return records even if one of the Address fields is <null>.
For reference, I have tried: Address3 LIKE @Address3 + '%' OR IS NULLThis does work, however itsimply returns every instance where Address3 is <null> (accounting for about 95% of the records in the database). Thanks in advance Simon
View 9 Replies
View Related