DataSource Controls :: Program A Select * From Rel Where Rel Like 'L'%'?

Jun 15, 2010

The following code is used to get a relation out of the database:

rel_SQL = "select * from Relatie where relatie_soort_nr = '" + rel_srt_nr + "' and relatie_naam like '%" + sel_Waarde.Trim() + "%'";

This code is a problem when you have a relation with ' in his/here name.

rel_SQL = "select * from Relatie where relatie_soort_nr = '1' and relatie_naam like '%L'%'";

As you can see there is one to many ' sign in the code, how can I solve this like problem?

View 3 Replies


Similar Messages:

DataSource Controls :: How To Program A Search Function

Jan 25, 2010

I'm on training in a company and i'm making a web application with an SQL server database..Now I created everything but i need to know how to program a search function..t's the point that when I search to a computer it'll put all the pc's with the matching word into the dropdownlist..Like when you search for "A" I get all the pc's wich has an 'A' in their name, I made everything, in the query builder I made a parameter with the textbox but i need not EXACT the value I typed but verything wich has it in it.

View 6 Replies

DataSource Controls :: Able To Run Program In Debug Mode But Not On IIS

Jan 11, 2010

I am currently working on this situation that I could not find any other resources online to help me
Everything is working fine through VS2008 debug mode, or run without debugging ( database connectivity and everything works)but however when i copy the whole project and set up the IIS,
everything work except for database connectivity. I could not seems to read from the database which currently I am using a attached .mdf file

the error shown is as below :

Server Error in '/' Application.

Object reference not set to an instance of an object.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

[Code]....

Source File: Signup.aspx.vb Line: 23 Stack Trace:

[Code]....

but however when i run on VS 2008, I am able to read the data from the database successfully,

View 4 Replies

DataSource Controls :: Programmatically Setting ODS Select Method And Select Parameters?

Dec 22, 2010

The drop down list is used to determine what search criteria will be used to find an invoice. I tried to set the Select method in the switch statement. I don't understand how to set the Select Method and the select parameters programmatically though . I tried a few different ways but can't make the compiler happy. My ODS is in scope in the code behind. I'm not able to access it's properties though. The BAL resides in a separate project that is a ClassLibrary. I also have a using statement for the ClassLibrary project in the code behind.

give me an example of how to do this?

Mark up:

[Code]....

[Code]....

[Code]....

[Code]....

View 1 Replies

DataSource Controls :: Select / Returns Error No Overloading Method For Select?

May 9, 2010

protected void Button19_Click(object sender, EventArgs e)
{
SqlDataSource conn = new SqlDataSource();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["Database2ConnectionString1"].ToString();
conn.SelectCommandType = SqlDataSourceCommandType.Text;
conn.SelectCommand = "SELECT FROM table1 (a, b)VALUES(@a,@b)";
conn.SelectParameters.Add("a",TextBox1.Text);
conn.SelectParameters.Add("b", TextBox2.Text);
int rowsAffected = 0;
try
{
rowsAffected = conn.Selectt();
}
catch (Exception)
{
Label1.Text = "Error";
}
finally {
conn = null;
}
if (rowsAffected != 0)
{
Label1.Text = "Data saved";
}
}

well it returns error no overloading method for select (P.S. same code work fine for insert)

View 5 Replies

DataSource Controls :: Declare Attribute With Select Top 1 / Error Incorrect Syntax Near The Keyword 'select'

Apr 14, 2010

I will declarate a attribute, but it gives me an error

This query works fine and returns 1 record from type int:

SELECT TOP 1 DataObjectVersionID
FROM tblDataObjectVersionPropertyValueText
WHERE PropValue like CAST('00010281' AS ntext)
ORDER BY DataObjectVersionID DESC

And when I will declarate a attribute/parameter it gives me an error:

DECLARE @dataObjectVersionId INT
SET @dataObjectVersionId = SELECT TOP 1 DataObjectVersionID
FROM tblDataObjectVersionPropertyValueText
WHERE PropValue like CAST('00010281' AS ntext)
ORDER BY DataObjectVersionID DESC

Error message:

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'SELECT'.

View 4 Replies

Visual Studio :: 2010 - Finding Assemblies In Program Files Vs Program Files X86?

Jul 3, 2010

I have a VS2010 project that I want to move back and forth between an x86 and an x64 machine. On the x86 machine, several assemblies are located in Program Files, and the path of the assemblies are shown as c:Program Files...... When I move this project to the x64 machine, the same assemblies are located in C:Program Files (x86).... Is there a way that I can confugure VS2010 so I don't have to manually change the path when I move the project from one machine to another?

View 1 Replies

DataSource Controls :: SQL Query With IF And Select

Feb 18, 2010

SQL Query with IF and Select

View 2 Replies

DataSource Controls :: How To Select / Use Two DBO For CommandText

May 2, 2010

I would like to combine two commandtexts into one

text1.CommandText = "SELECT Id, Heading as Head FROM dbo.Modul"
text2.CommandText = "SELECT Id, Caption as Head FROM dbo.Menu"

I want to combine these two into:

text3.CommandText = "SELECT Id, Heading as Head FROM dbo.Modul" + "SELECT Id, Caption as Head FROM dbo.Menu"

View 20 Replies

DataSource Controls :: Select By Location?

May 14, 2010

I have a table with number fields, one of which is location. What I want is a select command which put all records for the selected location first then adds all the others on the end in what ever order they occur.

View 1 Replies

DataSource Controls :: Select Top Record From Sql Statement

Mar 17, 2010

If I run the following SQL script:

[Code]....

View 3 Replies

DataSource Controls :: How To Select Top X Records From Each Group

Apr 7, 2010

i have two tables (Users, Roles) and each user belongs to one role. Can I make a sql query that returns 10 newest users from each role in one query?

View 5 Replies

DataSource Controls :: Sql Select Query Where Date

Apr 13, 2010

in DataBase Attendancedate is save in this format 4/5/2010 4:16:28 PM ..i want to query like this select * from EmployeeAttendance where Attendancedate='4/5/2010' but this giv error

View 5 Replies

DataSource Controls :: How To Select Statement For Some Scenario

Apr 24, 2010

I want the select statement for the above scenario.

View 2 Replies

DataSource Controls :: INSERT SELECT Statement?

Apr 30, 2010

How would you handle an INSERT that gets some values from another table using SELECT, where you wanted some values to come from the source table record and other values to come from a different parameter source like a session value? Is this possible?

View 3 Replies

DataSource Controls :: Executing The SP Across Select Statement?

Apr 17, 2010

I need to execute the stored proc accross the parameters resulted from select statement

I have created one stored procedure which require one parameters ( username ) ..

i need to execute this SP accross the Select Statement which lists all the username

somethibng like :

Set @username = (Select usename from my table)
EXEC dbo.Duplicate_Data @username

View 7 Replies

DataSource Controls :: SQL Select Inner Joins Using Count

Mar 17, 2010

I have a SQL select statement with inner joins to get a total number of records for the statement. I have tried using count with group by's but it just counts one for each record instead of giving me the total number of records for the query. Here is the query:

[Code]....

View 3 Replies

DataSource Controls :: How To Select Only Certain Columns With LINQ

May 11, 2010

If I have a linq statement like:

[Code]....

There may be a lot of data in the Blogs table. What if all I wanted was say BlogID, BlogTitle and BlogAuthor and nothing else, is there a way to do this in an effort to make the sql more efficent?

Along the same lines in my DataContext (.dbml) file I added some associations between some of my tables. This makes coding nice when I do a linq statement that will join those tables automatically for me but my concern is does it do that everytime, thus making all my linq quieries inefficient?

View 1 Replies

DataSource Controls :: How To Use Sqldatasource1.select() Correctly

Jan 14, 2011

I have a query that looks like this attached to a sqldatasource :

SELECT [fldBaseline] FROM [BI_PATHS_Target_Baseline] WHERE fldBranch = @fldBranch and
fldyear=@fldyear and fldcategory = @cat

and i want to make a LABEL to read that fldbaseline value and i tried this :

[Code]....

btw the @fldbranch is pulling from a dropdownlist and so it the @year but the @cat is just defined always as 'LEAN' But im not sure what to put inside the select() part. i know you have to put atasourceselectarguments.empty if no parameters, but what would I do here since their are 3?

View 6 Replies

DataSource Controls :: Select Rows In Given Order Of Ids?

Apr 22, 2010

My query was SELECT ID FROM TBLCARS WHERE (ID IN (1, 5, 3, 6))

this will usualy produces the result 1,3,5,6 order.But i want the result in the specefied order of ids.ie:1,5,3,6;ie;first get the row with id 1,then with id 5,then id 3,and last 6.

View 11 Replies

DataSource Controls :: Select Statement Across Three Tables?

Mar 17, 2010

[Code]....

Select statement across three tables

View 15 Replies

DataSource Controls :: Select Statement Excluding TOP 10?

Jul 6, 2010

I need to create a SELECT statement for a table that excluded the TOP 10 records.

"SELECT TOP 10 field1,field2,field3 FROM AppData ORDER BY field1 DESC" returns the first 10 records from the table but I need to retrieve only from the 21st record onwards.

I simply don't know how to do it because I'm not that strong with SQL. I searched the forum for some answers but can't find a solution that I can understand.

View 4 Replies

DataSource Controls :: Syntax With Select Paramaters?

Jan 1, 2010

I have a problem with my SQL statement that only needs to show future dates in the Gridview.I use vb, vs 2005.I want a DateTime Field(TEndDate) to act as a control field in that only future dates (WHERE TEndDate >= Now.Date.Date) should be returned.It asks for my paramaterized value when I'm building the query.I'm unsure about the source I should select for the query.(The options are: None/Control/Cookie/Form/Profile/Querystring/Session)I'm losing my mind with this!Here is my code:

[Code]....

View 2 Replies

DataSource Controls :: Select An Integer Value And Then Pad It With Blanks?

Jul 6, 2010

I am reading an integer named "CostIndex" from a database table.I need to cast it to an integer and then pad the result withleading zeroes.So if CostIndex is only one digit then I need to pad it with 3 leading
blanks: 0007I know how to find the length, using LEN,but I don't know what to do beyond that? select CAST(CostIndex AS VARCHAR(4)) from TableRoot

View 3 Replies

DataSource Controls :: Select Rows From Table?

Mar 16, 2010

I need to select the rows between 20 to 30 from a table without using where condition. How is it possible?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved