Keyword Top Can't Be Used In SQL Mobile, Is There Any Substitute?

Jan 15, 2007

I only want to select few records from table

Keyword "Top" can't be used in SQL Mobile, is there any substitute?

View 7 Replies


ADVERTISEMENT

Substitute For First Keyword?

Mar 27, 2008


IS there ny substitute for this ?

=First(Fields!TouchedBy.Value, "Dataset1")

instead of keyword 'First' i need the current record , but also i need to refer dataset name also , is there any way to do that ?

Any idea?

thanks

View 7 Replies View Related

Substitute Of 'IN' Operator

Jan 31, 2005

Hello folks,

I've got a table like this

PRODUCT_ID LABEL_ID
----------- -----------
6 1
6 2
7 1
1 1
2 1

I need to have a select statement to take all the products with the LABEL_ID containing 1 AND 2. I can't use the IN operator as it will return me results with LABEL_ID 1 OR 2. Is there any solution to this? Sorry I'm relatively new to mysql and not familiar with the select statements.

I'm currently working on something like a search engine. Hope to have some good advice here :)

View 6 Replies View Related

A Substitute For UNION?

Feb 19, 2007

I'd like to change query:SELECT DM.*, 'condition1', NULL FROM DMWHERE (condition1)UNIONSELECT DM.*, NULL, 'condition2' FROM DMWHERE (condition2)to one SELECT like thisSELECT DM.*, WasCondition1, WasCondition2 FROM DMWHERE (condition1) or (condition2)but how to fill in the WasConditionX column?The UNION version was bad because in case a row fulfilled 2conditions, it was repeated instead of joining them, such like this:SELECT DM.*, 'condition1', 'condition2' FROM DMWHERE condition1 AND condition2UNIONSELECT DM.*, 'condition1', NULL FROM DMWHERE condition1 AND NOT condition2UNIONSELECT DM.*, NULL, 'condition2' FROM DMWHERE NOT condition1 AND condition2or (say DM has columns A, B, C):SELECT A, B, C, SUM(cond1), SUM(cond2) FROM(SELECT DM.*, 1 AS cond1, 0 AS cond2 FROM DMWHERE condition1UNIONSELECT DM.*, 0 AS cond1, 1 AS cond2 FROM DMWHERE condition2) AS DMGROUP BY A, B, C

View 12 Replies View Related

Regarding Substitute For BCP In 2005

Oct 24, 2007


Hi,

I'm using sql server 2005, i want to know is there any substitute for BCP in sql server 2005,
like how we have DTS in 2000 and SSIS in 2005,
I heared that BCP will be deprecated in the next version of Sql server.
so i dont want to implement BCP in 2005 version,

Will someone please tell me whether i have to implement BCP in sql server or we have some other option,
i dont want to use SSIS instead of BCP because latter is faster.


Thanks
Altaf Hussain Nizamuddin





View 4 Replies View Related

Substitute The Value Of The Textbox

Mar 29, 2008

Do anyone know how I can replace or Substitute the current value of a form textbox with another value.For example, the string "YES" appears on the textbox but hit the SAVE button I would like "TRUE" to be entered in the SQL Server database table. Thanks.

View 6 Replies View Related

Does SQL Substitute Float = 0 With DBNull.Value?

Mar 11, 2004

Hi
I have only been coding in .Net for about six months, and am not sure if this is a C# problem or an SQL one. I use the Data Access Application Block in my program.

I have two optional fields on my form (RangeFrom and RangeTo). If the user chooses not to enter data into these textboxes(textbox = ""), an entry on the db is created with null values. It works.

But sometimes the user wants to enter 0 as either an upper or lower end of a range. This is where my problem comes in. My program saves 0 as null too.

In my program I do a test on the textboxes and populate two float values in a business object (objQuestion) accordingly, like this:


if (txtrangefrom.Text != "") {
objQuestion.RangeFrom=float.Parse(txtrangefrom.Text);
objQuestion.RangeTo=float.Parse(txtrangeto.Text);
}
else {
objQuestion.RangeFrom=Convert.ToSingle(null);
objQuestion.RangeTo=Convert.ToSingle(null);
}


And this is what my Business object look like. It sets up the parameters and calls the Data Access Application Block to create an entry in my table:


// fieldslist
float cvintRangeFrom;
float cvintRangeTo;

//properties
public float RangeFrom {
get {
return cvintRangeFrom;
}
set {
cvintRangeFrom = value;
}
}

public float RangeTo {
get {
return cvintRangeTo;
}
set {
cvintRangeTo = value;
}
}

// some code deleted for readability....

public int AddOption() {
string cvstrSpName = "addOption";
SqlParameter [] cvstrStoredParams = SqlHelperParameterCache.GetSpParameterSet(gcstrConnectionString, cvstrSpName, true);
//lines deleted for readability...
//check if the optional fields have a value associated with them. if not, assign dbnull.value.
cvstrStoredParams[4].Value=(cvintRangeFrom != Convert.ToSingle(null) ? cvintRangeFrom : (object)DBNull.Value);
cvstrStoredParams[5].Value=(cvintRangeTo != Convert.ToSingle(null) ? cvintRangeTo : (object)DBNull.Value);
//lines deleted for readability...
SqlHelper.ExecuteNonQuery(gcstrConnectionString, CommandType.StoredProcedure, cvstrSpName, cvstrStoredParams);
return(cvintOptionID = Convert.ToInt32(cvstrStoredParams[0].Value));
}


I use Convert.ToSingle when working with nulls (or possible nulls) because I get an error when I use float.parse for this.

The thing is, after this method AddOption has been executed, I test the value if the business object's rangefrom (that is where I entered 0) and display it on my form. I still shows a 0, but on my database table it is null!


objQuestion.AddOption();
//txtrangefrom.Text=""; on the next line I test the value in the business object...
txtrangefrom.Text=objQuestion.RangeFrom.ToString(); // and this displays 0!!!
//txtrangeto.Text="";
txtrangeto.Text=objQuestion.RangeTo.ToString();


So to me it seems the problem seems to be either the DAAB or on the SQL side, but hopefully somebody can prove me wrong! I was thinking that it could also be float.parse/Convert.ToSingle methods and have done various tests, but I am none the wiser...
Any help or ideas will be greatly appreciated...

View 2 Replies View Related

Substitute For Temporary Table?

Jun 2, 2006

Hello once again,
My last question concerns (temporary) tables. In a web form (VWD Express, Asp,Net 2.0, VB, .mdf db, Ajax) I have two gridviews. One gets its data from textboxes and dropdownlists as the user clicks an ok button. This data is then sent to a "junk" table in the db. The other gridview retrieves this data "automatically" and displays the data, filtered and grouped by some SQL statements. When the user finally clicks an Insert record button, the data from this second gridview gets inserted in another table in the db and the data from the first "junk" table is disposed.
I guess it shouldn't be necessary to insert, retrieve, and delete the data in and from the "junk" table. Even though it does work like a charm, I guess it would be better if I could do it wit hsome kind of "temporary table", array or the like so that the db wouldn't need to be updated to this extent. Still, I really like the simplicity of using gridviews and the rest of the page's code is complex enough, so I don't really want to substitute this behaviour for tons of hand-written, hard-to-follow, and hard-to-integrate code.
What are my options? Any help would be greatly appreciated.
Pettrer

View 2 Replies View Related

Substitute Of Format(myColumn,0.00) Function

May 10, 2006

hi,

the query ----> select format(Total,"0.00") from mytable works very well in MS Access 2000/97 but the same query dosen't work in MS SQL Server 2000.

i need the substitute for this query. please help me it's very urgent

thanks a lot for consideration

Vikas

View 1 Replies View Related

Which Filed Type Is Substitute Of MEMO In SQL Server?

Jun 3, 2004

Hi,


I need to store large note in SQL Server field, what is substitute of Access's Memo filed in SQL Server?

Appreciated...

View 6 Replies View Related

Can *datastore.xml Be Used To Populate Template.ini As A Substitute For Setup.iss?

May 2, 2006

Objective

Do a manual installation of SQL Server 2005 (which could be an upgrade from SQL Server 2000) and record the steps. Replay the steps for an unattended installation of SQL Server 2005.

Problem

There isn't a setup.ini file for SQL Server 2005. There is a template.ini for unattended installations of SQL Server 2005, but it doesn't obviously map to selections on manual installation dialog boxes.

Desired workaround

Capture the steps of a manual installation and use them to populate template.ini.

Relevant background for a potential solution

A manual installation creates log files. So does an unattended installation. But the unattended installation writes all of the log files into a single zip file.

What is important to know is that an unattended installation creates an additional file, a *datasource.xml file. This XML file is found in the zip file with all of the other log files. If you open this XML file, you'll see that the attribute names correspond to keywords in template.ini.

Potential solution

If a manual installation could be forced to generate a *datasource.xml file, then it should be possible to map the settings in the file to keywords in template.ini.

So, how can a *datasource.xml file be created? In post http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=359678&SiteID=1, Jeffrey Baker says "add LOGNAME=<path to cab> and run setup again". Unfortunately, these instructions are too vague. Where is this added? To the command line, to a setup.ini (if so, in which directory, and in which section should he addition be made?). I did lots of searches and couldn't find the answers.

View 1 Replies View Related

T-SQL (SS2K8) :: Substitute Hour Part Of Datetime Field?

Apr 27, 2015

I have a table with a datetime field (named "lnDateDone") and an integer field (named "PlannedHour"). I want to build a new datetime field with the same value as lnDateDone and replacing the hour part by the PlannedHour field. Example:

lnDateDone = '2014-04-09 13:22:31.544'
HourPlanned = 14
new datetime field = '2014-04-09 14:00:00'

I tried the following:

CAST(SUBSTRING(CAST(lnDateDone AS VARCHAR(25)),1,12) + CAST(PlannedHour AS VARCHAR(2)) + SUBSTRING(CAST(lnDateDone AS VARCHAR(25)), 15, LEN(lnDateHeureFin)) AS SMALLDATETIME) AS DatePrevue

but it won't work when casted in DateTime format, only in varchar, but I want it in datetime as I need to do compute some values using date manipulation functions.

How can I do that?

View 4 Replies View Related

SQL Server 2008 :: Substitute Line Breaks For A String

Aug 17, 2015

Is it possible to change any line breaks or newlines for a string ...

In a select statement in a store procedure, in this way I can reproduce text in a label on a webpage complete with line breaks ....

View 4 Replies View Related

SQL Server Mobile 2005 Merge Replication Problem On Windows Mobile 5.0

Aug 8, 2006



Dear ppl,

I am writing an application for a device (MDA Pro T-Mobile) having Windows Mobile 5.0 using

-MS .NET Compact Framework 2.0 SP-1
-SQL Mobile 2005.
-VS 2005 .NET

The application uses Merge Replication. The error occurs in the Synchronise() Method of the SqlCeReplication object.

"SQL Server Mobile encountered problems when opening the database."

repl.AddSubscription(AddOption.CreateDatabase);
repl.Synchronize();

I don't understand why I am having this error. It does create the database on AddSubscription() method but it is failing opening the database on Synchronise(). I have also tried uninstalling and then reinstalling all the SQL Mobile components in the following order.

-sqlce30.wce5.armv4i.cab
-sqlce30.repl.wce5.armv4i.cab
-sqlce30.dev.ENU.wce5.armv4i.cab

However, when i run this application on a device(Dell X50 AXIM) with Pocket PC 2003, it runs fine creating the database and sysnchronising it.

The target platform for the project is Windows Mobile 5.0 Pocket PC SDK.

Does any one have any clue what could be the problem ?

Regards
Nabeel

View 6 Replies View Related

SQL Mobile 2005 Replication - SQL Mobile DLL Could Not Be Loaded - Error 28559

Jun 15, 2006

I am migrating a pocket PC application from VS 2003 to VS 2005 and a few weeks ago I hit the following problem when replicating

A SQL Mobile DLL could not be loaded. Reinstall SQL Mobile. [ DLL Name=sqlceca30.dll]

Scanning forums for help I saw that other people had had this problem and one

http://www.eggheadcafe.com/aspnet_answers/NETFrameworkCompactFramework/Feb2006/post25814466.asp

suggested that this problem could be circumvented by getting the replication object early and then continuously using the same object for subsequent replications.

I did this and it works a lot better now but ever so often I get another error which is

Native Error 28559 SQL Mobile encountered problems when opening the database

My only option at this point is to stop and start the application which cures the problem.

View 4 Replies View Related

Problem Using SQL Server Mobile 2005 With Windows Mobile 5 Application

Mar 23, 2006

Hello,

I am developping a non-managed C++ application for PocketPC using a SQL Server mobile database.

The application is compiled for PocketPC 2003 and uses SQL Server Mobile v2. I use Visual Studio 2005. But I need to compile the application for Windows Mobile 5.0 devices. So I installed the WM5 SDK and had the WM5 into my project configuration.

The "ssceoledb.h" which I include incluses the "transact.h" file. But my problem is that this file is only provided with the PocketPC 2003 SDK and not in the WM5 SDK.
So I cannot use the WM5 configuration project with SQL Server. I also tried with the last SQL Server Mobile 2005 (ie v3.0) and the "ssceoledb30.h" also includes "transact.h".

Did I miss something to install ?
Do you know how I can resolve the problem ?

By advance, thank you for any answer.

--
Gregoire

View 9 Replies View Related

Cannot Build SQL Server Mobile Solution For Windows Mobile 5

May 18, 2006

Using MS VS 2005 (incl SQL Server Mobile)
MS Pocket PC 2005 SDK

I am working on a project that builds for Pocket PC on both Mobile 2003 and Mobile 5. The project uses/will use SQL Server Mobile to store local data.

Project created from new with support for both platforms. I include required header files ssceerr30.h and ssceoledb30.h.

Project builds fine in WM2003 configuration, release and debug.

When I build for WM5 the compiler cannot find the header file transact.h. This is included from within ssceoledb30.h. Same as under WM2003.

In WM2003 configuration if I highlight the ssceoledb30.h include in Visual Studio and open the header, it takes me to <Visual Studio dir>SmartDevicesSDKSQL ServerMobilev3.0. I then locate the include for transact.h and do the same, which takes me <Visual Studio dir>SDKPocketPC2003include. The file exists.

If I repeat the above 'browsing' under the WM5 configuration, ssceoledb30.h takes me to a different copy in the WM5 SDK directory. There is no diff between the file here and the other copy used by WM2003. If I attempt to open transact.h - file does not exist.

Fix (which I'm not too sure about, i.e. is it OK?) - If I copy transact.h to the WM5 SDK directory, the project builds.

Why has transact.h disappeared from WM5 SDK?
I can find no ref's to this problem anywhere. Is my installation of the WM5 SDK corrupt? What else could I be missing?
Is there a sample for SQL Server mobile (like the NorthwindOLEDB sample) that comes configured to build for WM5?

View 1 Replies View Related

Access SQL2005 MOBILE Database In A VS2003 Mobile App

Mar 6, 2006



It is possible to access a Sql Server 2005 Mobile database in a VS2003 application (compact framework) ?

Thanks

Robson

View 4 Replies View Related

Error #25123 A Sql Mobile DLL Could Not Be Loaded. Reinstall SQL Mobile.

Sep 8, 2007

I receive error 25123 on my PPC (audiovox 6600) in a reproducable way (usually) with .net 2.0 application that is using SQL CE that I wrote:

Open the application
Connect to the database
Close the applicaton
Re-Open the application
Connect to the database <-- Error occurs


I will also receive the error if my application isn't the first application launched (or very close to the first to launch).

I don't believe it's a memory issue as according to the memory manager I have plenty of memory:

At boot up only start screen items loaded: 18.46 Used 49.89 Free
Launch Resco File Explorer to click EXE: 19.18 Used 49.18 Free
Launch my application (no DB connection): 23.64 Used 44.71 Free
Connect to the DB and do select count(*) from a table with 0 rows: 26.27 Used 42.08 Free
Close the application (this.Close() on the form: 19.38 Used 48.97 Free
Relaunch App and connect to DB receive error: around 38 Used around 30 free

I was unable to reproduce the issue right now while typing this message, the last sets of numbers are from memory, and include other applications that are currently running.

The only way I have to get SQL CE to load again is to soft reset the PPC. If the application is able to connect to SQL CE at least once it is fine up till I close it and re-open the application. So it either connects and runs great, or it can't connect at all.

Any help in resolving this issue would be greatly appreciated.
Wayne

View 1 Replies View Related

SQL Server Mobile Tutorial And Getting Proper Mobile DB Installation

Apr 24, 2006

Hi folks, I'm new to Windows Mobile progamming, and new to this forum. Apologies in advance if I'm asking a boneheaded question, but I've done searches and can't find anything directly applicable to my problem.

I'm currently walking through the published MS tutorial in setting up an SQL Server 2005 Mobile application that subscribes to a publication on SQL Server 2005 to exchange information.

I've gotten almost all the way through... successfully set up the server components, creating the publication, etc. On the mobile side, I've been able run the cab files to install the SQL Mobile components and to create the project, add the reference to the dll, and instantiate an engine object. It compiles.

The step in the tutorial after that, though, where you specify the data source from the "data" menu, I've got a problem. When I try to use the "new connection" dialog from choosing the data connection, "MS SQL Server Mobile Edition" doesn't show up as a choice. I've tried choosing any of the other combinations, and in teh subsequent "Connection properties" section my database, SQLMobile (as in their sample) is available, but I get an error when I choose it and click OK. Clicking on "Test Connection" gives me a connection successful message.

My guess is that something about the Mobile server side components is not installed correctly on my development machine, but honestly I have no idea how to begin to fix it. Has anyone seen this problem before and know how to resolve it?

Your time and any knowledge sharing is greatly appreciated.
Thank you,
-Dana

View 8 Replies View Related

Creating A Mobile Application With SQL Server Mobile - FIX

Jul 21, 2006

This is a great tutorial and it's a shame one of the more important steps was missed.
In the €œCreate the snapshot user€? section you you find the steps to create the snapshot_agent account. Then in the €œCreate the snapshot folder€? section you find the share and folder permissions. However, at no point do the instructions advise you about adding the snapshot_agent to the SQL Server Logins. The result is that agent cannot perform the initial snapshot but you won't find this out until 50 steps later after Step 10 in the section  €œCreate a new subscription".
 
To get back on track, openthe Object Explorer's Security section and add the snapshot_agent to your logins. Then using the "User Mappings", set an appropriate level for the SQLMobile database role. Once completed you then need to run the agent.
 
Right-click the SQLMobile publication you created and select "View Snapshot Agent status". From that dialog you can select "Start" to run the agent. When it completes, you can return to the tutorial section "Create a new subscription" and continue with the tutorial.
 

 

View 4 Replies View Related

Creating A Mobile Application With SQL Server Mobile

Nov 3, 2007

I am studying the tutorial in SQL Server 2005 Mobile Edition Books Online, and the topic is Creating a Mobile Application with SQL Server Mobile. I have got a problem when creating a new subscription after created a new SQL Server Mobile database. And the problem is shown below:

New Subscription Wizard

- Beginning Synchronization (Success)

- Synchronizing Data (100%) (Error)
Messages
* Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)

* 無法完�作業。


- Finalizing Synchronization (Stopped)

- Saving Subscription Properties (Stopped)

Before I have met this problem, I have finished all the task. And I can browse the localhost web site by using anonymous account even I use internet explorer or browse the directly in IIS.

Does anyone can solve it?? Thank you very much~~~

View 3 Replies View Related

SQL Server Mobile Merge Replication Walkthrough, Cant Find The .NET Framework Data Provider For SQL Server Mobile Edition.

Sep 9, 2005

Hi,

View 3 Replies View Related

SQL Server 2005 Mobile Edition ANd SQL Server CE - SHould I Have Uninstalled Mobile First ?

Sep 16, 2007



Hi:

When I try and connecto to SQL CE I always get an invalid operation exception. I"m afraid that I did not follow the proper install for Orcas Beta 2. I can't remember if I was supposed to uninstall SQL Mobile 2005 first or not.

All I know is when I try and use my SQL CE I can't connecto to a DB / sdf file ?

Any help would be appreciated I"m just starting to use SQL CE.

thanks
mark

View 2 Replies View Related

Incorrect Syntax Near The Keyword 'SELECT'.Incorrect Syntax Near The Keyword 'else'.

May 22, 2008

What I am trying to create a query to check, If recDT is not value or null, then will use value from SELECT top 1 recDtim FROM Serv. Otherwise, will use the value from recDT. I have tried the below query but it doesn't work. The error says, Incorrect syntax near the keyword 'SELECT'.Incorrect syntax near the keyword 'else'.1 SELECT
2 case when recDT='' then SELECT top 1 recDtim FROM Serv else recDT end
3 FROM abc
4
Anyone can help? Thanks a lot.

View 5 Replies View Related

Problem With Isnull. Need To Substitute Null If A Var Is Null And Compare It To Null And Return True

Sep 20, 2006

Hey. I need to substitute a value from a table if the input var is null. This is fine if the value coming from table is not null. But, it the table value is also null, it doesn't work. The problem I'm getting is in the isnull line which is in Dark green color because @inFileVersion is set to null explicitly and when the isnull function evaluates, value returned from DR.FileVersion is also null which is correct. I want the null=null to return true which is why i set ansi_nulls off. But it doesn't return anything. And the select statement should return something but in my case it returns null. If I comment the isnull statements in the where clause, everything works fine. Please tell me what am I doing wrong. Is it possible to do this without setting the ansi_nulls to off??? Thank you

set ansi_nulls off


go

declare

@inFileName VARCHAR (100),

@inFileSize INT,

@Id int,

@inlanguageid INT,

@inFileVersion VARCHAR (100),

@ExeState int

set @inFileName = 'A0006337.EXE'

set @inFileSize = 28796

set @Id= 1

set @inlanguageid =null

set @inFileVersion =NULL

set @ExeState =0

select Dr.StateID from table1 dR

where

DR.[FileName] = @inFileName

AND DR.FileSize =@inFileSize

AND DR.FileVersion = isnull(@inFileVersion,DR.FileVersion)

AND DR.languageid = isnull(@inlanguageid,null)

AND DR.[ID]= @ID

)

go

set ansi_nulls on

View 3 Replies View Related

In Keyword With INT

Oct 18, 2007

I am trying to pass several ids to use in a where clause.   1 For Each row as GridViewRow In gv_child.Rows
2 If row.RowType = DataControlRowType.DataRow Then
3 Dim chk as CheckBox = CType(row.FindControl("cb_Approve"),CheckBox)
4 If chk IsNot Nothing AndAlso chk.Checked Then
5 Dim id As Integer = CInt(CType(row.FindControl("lbl_id"),Label).Text)
6 ids &= "," & id
7 End If
8 End If
9 If ids.Length > 1 Then ids = ids.Substring(1)
10 'Submit to sql with ids as param...
11 Next

 
I am getting an exception.  Error converting '38,39' to a column of datatype int.  What am I doing wrong?

View 7 Replies View Related

BETWEEN Keyword

Mar 6, 2004

I need to retrieve records where the date is in between the current date and 4 days previous.

I've tried: WHERE DateSubmitted BETWEEN GetDate() AND GetDate() - 4
it doesn't work...

Can someone help out?

View 2 Replies View Related

Is Name A Keyword?

Dec 27, 2005

It's blue in SQL Studio but I can't find it in SQL Books on-line. Iwanted to use it as a field name but don't like using [].Is it reserved?

View 6 Replies View Related

GO Keyword

Nov 21, 2007

Hi guys,

Just a newbie question here.

Do we really need to use the GO keyword?

Thanks,

MeTitus

View 1 Replies View Related

Keyword Search

May 27, 2007

I am trying to implement a band search on my web site (concert listings) and would like it to behave a bit more intelligently than a standard match on the band name.
At the moment I have a stored procedure that just selects every show that features a band with exactly the same name as the search term. What I'm now trying to do is when the user enters a band name containing the '&' character I would also like to search using the word and 'and'. For example, if they search for 'Rise & Fall', they should get details on all shows featuring 'Rise & Fall' OR 'Rise And Fall'. Is it possible to do this within my stored procedure?

View 2 Replies View Related

Search By Keyword

Jan 31, 2008

 Greetings,  I am a php developer, and running a little bit out of deadline in a project. Can someone provide me with a VERY simple way to implement search by keyword in C#?  I have already implemented a search page (according to firstname, lastname etc) that works on a drop down menu (where you have the option to choose seach by keyword) . So, I need to change something in my SQL query to make this work. I already knew from my SQL experience that the simplest and probably the SLOWEST and MOST UN EFFICIENT one was using LIKE. I don't mind using it but I can't since I will end up  having something close to that: SELECT * FROM users WHERE keyword_entered LIKE @keyword;      (or '@keyword)  which does not work.      however SELECT * FROM users WHERE keyword_entered LIKE 'somename%'; does work! I guess the trick is in putting the % after the keyword. ( I would have done that in php by putting the entered keyword in a string and than add to it % and pass it to the SQL query and I dunno how to do that in .NET)any ideas? 

View 7 Replies View Related

Using Keyword Question...

Apr 3, 2008

Hi everyone,
 I have a few classes representing my data layer for my ASP.Net 2.0 Web Application. For example, UserDAL, DocumentDAL, etc... All these classes derive from BaseDAL, which stores the SqlConnection in it. The DAL classes access it through a property. The property is defined like that:
private SqlConnection connection;public SqlConnection Connection{get{  if (connection == null)                 connection = new SqlConnection();  if (connection.State != ConnectionState.Open)  {                connection.ConnectionString = ConnectionString;                 connection.Open();    }  return connection;}}
The constructor of each DAL class is overloaded and takes a SqlConnection object. So if I need to access two DAL classes, I pass the connection of the first, to the second to prevent opening and closing the connection again and again. Here is a sample: UserDAL userDAL = new UserDAL();
userDAL.DoSomethingAndAccessConnectionProperty();

// Now userDAL.Connection is opened. Pass the connection to the constructor of DocumentDAL
DocumentDAL documentDAL = new DokumentDAL(userDAL.Connection);
documentDAL.AlsoDoSomething();
So, if I do the following:using (UserDAL userDAL = new UserDAL())
{
userDAL.DoSomethingAndAccessConnectionProperty();

DocumentDAL documentDAL = new DokumentDAL(userDAL.Connection);
documentDAL.AlsoDoSomething();
}
I assume that the connection is removed from memory, even if the DocumentDAL class has also used it. Am I right? I want to be sure that there will be no open connections.Thanks

View 6 Replies View Related







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