How to get the string array that starts with prefixtext

 Helloo,

 

i am using a web service to autocomplete a textbox

The database contains a keywords column ..each colum contains more than 1 keywords  LIKE "INDIA WORLD IRAQ"

So i need to use RegEx to split each keywords.

But How can i extract only strings that starts with the prefixtext into an array??

Please Helpp

I hav put my code below 

  

1     public string[] GetKeywords(string prefixText, int count)
2            {
3                // int count = 10;
4                string connString = ConfigurationManager.ConnectionStrings["dnas_newConnectionString"].ToString();
5                string sqlselect = "SELECT TOP 10 Keywords FROM Page WHERE Keywords LIKE '%" + prefixText + "%'";
6                string[] keywords = new string[10];
7                
8                int j = 0;
9                List keywordlist = new List<string>(count);
10   
11   
12               using (SqlConnection conn = new SqlConnection(connString))
13               {
14                   conn.Open();
15   
16                   using (SqlCommand cmd = new SqlCommand(sqlselect, conn))
17                   {
18                       SqlDataReader dr = cmd.ExecuteReader();
19                       while (dr.Read())
20                       {
21   
22                           keywordlist.Add(dr["Keywords"].ToString());
23                           
24                          
25                               keywords = Regex.Split(dr["Keywords"].ToString(), " ");
26                          
27                          
28                           //int j = 0;
29                           //for (int i = 0; i < keywords.Length; i++)
30                           //{
31   
32                           //    Match myMatch = Regex.Match(keywords[i], @"^" + prefixText + "");
33                           //    if (myMatch.Success)
34                           //    {
35                           //        items.SetValue(keywords[i], j);
36                           //        j++;
37                           //    }
38                           //}
39                       }
40                   }
41   
42   
43   
44   
45                   
46                     //return keywords;
47               }
48               //return items;
49           }
50       }
 

Regards

Faisal
 


faz
0
faisalpar
3/25/2008 6:47:02 AM
asp.net.ajax-discussion 13973 articles. 1 followers. Follow

0 Replies
570 Views

Similar Articles

[PageSpeed] 2

Reply:

Similar Artilces:

How do I get started with AJAX.Net?
Hi All, I'm a seasoned asp.net developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first http://ajax.asp.net/downloads/default.aspx?tabid=47 then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

Starting an Ajax.net Application in .net
i am new to ajax.net could any one give me simple ajax,net example so that i start building on my ajax skills please.........  I started with the todolist video on the main asp.net/ajax page, and its all you need to know to get started. http://download.microsoft.com/download/0/f/6/0f651a0f-6f2b-4497-b061-e1b2825e22e0/MSAJAX-ToDoList.wmv Don't forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. http://asp.net/ajax/    ...

How to copy strings in array of strings....I am getting some errors....
Hi, I want to display all the file names that are present in a specified directory....say "C:\data" in a GridView for that I am using the following: Imports System.IOPartial Class _Default Inherits System.Web.UI.PageProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strFileSize As String = ""Dim di As New IO.DirectoryInfo("C:\data") Dim aryFi As IO.FileInfo() = di.GetFiles()Dim fi As IO.FileInfo For Each fi In aryFi strFileSize = (Math.Round(fi.Length / 1024)).ToString() Response.Write(fi.Name)...

Getting started with Ajax
 Hi - I am trying to get started with Ajax but cant seem to get it working.  I have visited the Ajax website but it's not clear (to me at least) how to get up and running.I am using VS 2008 and have applied all the updates - could someone tell me (in a nut shell) how to get started and what I need to do?Thanks in advance,James jparry:Hi - I am trying to get started with Ajax but cant seem to get it working Hi, Can  you let  us  know  as to  what  you  want to  achieve  using  AJAX ,   in  that  way ...

AJAX 1.0 RC Getting started #1 Does not work for me an Ajax newbie
Great I thought I have a couple of hours to start using AJAX I have VS 2005 and am familair with ASP.NET 2 Went to http://ajax.asp.net/Default.aspx Downloaded ASP.NET AJAX 1.0 RC  - as per the instructions Followed Scott Guthrie Video Developing ASP.NET Applications using AJAX ..... They did not work the syntax is different - it msut have been for an older version  Went ot the "How Do I Section " run  "#1 DOw Do I Get Started with ASP.NEt AJAX" 'UPDATED for AJAX RC" - 2 controls, 1 button and 2 labels - IT DID NOT WORK ! - It compiled etc but both times updated ...

Getting started with AJAX
i've had a look at a couple of websites detailing it but what i'd really like is a good book that i can work through learning about AJAX and its capabilitiesso anyone any reccomendations on good AJAX books out there??Cheers,Craig I would suggest picking up a book on javascript first before going into AJAX straight away, you will need to make sure that you know who to manipulate DOM.  There is a book that I have read from sitepoint.com:http://www.sitepoint.com/books/dhtml1/That book will show you a sufficient amount of detail to use AJAX, then you could go for a generic book on AJAX i....

Getting started with Ajax
I have Visual Studio 2008 standard. I have created a Ajax web site before -- several weeks ago. In order to get rid of problem that I had uninstalling asp.net Mvc beta I took VS2008 off of my system. Now, when I go into (create) new website I find the following list: Asp.Net Web Site, Silverlight Script Web, Asp.Net Web Service, Empty Web Site, WCF Service, Asp.Net Reports Web Site, Dynamic Data Entries Web Site, Dynamic Data Web Site. When I go to the About dropdown of VS 2008 it says the following: Microsoft Visual Studio 2008 Version 9.0.30729.1 SP1 and on the otherside Micros...

how to get started with AJAX
hi Every1, i'm completely novice to AJAX, so i dont know how to get started. i've installed Ajax Exetsions from http://ajax.asp.net, then control tool kit. now i want to work with controls like accordion etc but i've visual web developers & i'm trying to add reference to ajaxcontroltoolkit.dll but in vain i'm getting error saying there was error loading types from assembly. could someone please guide me. regards, satish.Kind Attn: If a reply to your post helped you, kindly mark it as Answered.__________________________________________________Please save Animals Help World Society Fo...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

From where i have to get start in Ajax ?
Hi all, I want to start working on ajax in asp.net 2.0 what i have to to for getting start in Ajax using asp.net 2.0 any help or some useful links are highly appericated . Best Regardslife is name of learning!Mark as an answer if it helps Rameezwaheed: Hi all, I want to start working on ajax in asp.net 2.0 what i have to to for getting start in Ajax using asp.net 2.0 any help or some useful links are highly appericated . Best Regards Download AJAX Extensions and for the tutorials here http://www.asp.net/learn/ajax-videos/MAKMark as Answer if this reply helps youMVP ASP/AS...

Getting Start With .net
hi i'm intersted to learn asp.net (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about microsoft.net with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or delphi.net) thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

Trying to dynamically create arrays, getting can't use string as ARRAY ref
Greets. I have a 'config file' that contains a group name (alphanumeric) and machine name/numbers separated by whitespace. Each group is on it's own line. The file looks like this: prod01 456 345 234 prod02 789 517 325 ....etc, etc, etc... What I am attempting to do is: Put the file contents into an array Pull the first entry off the array Add the name of the array to a 'master array' list of the machine groups Then create another array, which would be referenced by the group name, and contains the machines associated with the group. Here is the code...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

how to get string array from arraylist
Hi, I am emaressed for asking this question but, is there a better, or shorter way to build "roles" array? Thanks in advance Dim WFIUser As New WFIUser(txtUserName.Text) WFIUser.Authenticate(txtPassword.Text) If WFIUser.IsAuthenticated Then Dim roles(WFIUser.Roles.Count - 1) As String Dim role As WFIRole Dim idx As Integer For Each role In WFIUser.Roles roles(idx) = role.Id idx += 1 Next Dim strRoles As String ...

Web resources about - How to get the string array that starts with prefixtext - asp.net.ajax-discussion

Sleep Therapy Pillow/Pillow Speakers
Sleep Therapy Speakers allow you to turn any pillow into a Sleep Therapy Pillow. These insomnia sleep machines help you enjoy nature sounds for ...

Resources last updated: 2/3/2016 10:54:17 PM