15,867,568 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by M Adeel Khalid (Top 21 by date)
M Adeel Khalid
26-Nov-15 5:16am
View
Ok.
M Adeel Khalid
9-Jun-15 6:44am
View
link doesn't work.
M Adeel Khalid
8-Apr-15 0:26am
View
:D
M Adeel Khalid
7-Apr-15 9:03am
View
thank you so much for telling that it is my problem, i thought it might be someone else's problem. Hats Off 2u.
M Adeel Khalid
3-Apr-15 6:05am
View
s4, n3 are string which store url name after removing starting "http://" or "http://www."
M Adeel Khalid
3-Apr-15 5:14am
View
Deleted
I'm using the following code to separate internal and external links but it doesn't work as I need. It's been 2 days I'm working on it but still no improvements. Can you check this and guide me about it.
List<string> inter = new List<string>();
List<string> dates = new List<string>();
int count = 0;
List<string> i2 = new List<string>();
WebClient web = new WebClient();
string html = web.DownloadString(textBox1.Text);
string n3 = "", s4 = "";
MatchCollection m0 = Regex.Matches(html, @"<a[\s]+[^>]*?href[\s]?=[\s\""\']+(?<href>.*?)[\""\']+.*?>(?<filename>[^<]+|.*?)?<\/a>", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
foreach (Match m in m0)
{
string city = m.Groups[1].Value;
Match m2 = Regex.Match(city, "\\s*(?i)href\\s*=\\s*(\"([^\"]*\")|'[^']*'|([^'\">\\s]+))", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
string city2 = m2.Groups[1].Value;
dates.Add(city2);
s4 = textBox1.Text;
string n2 = s4.Remove(0, 11);
n3 = s4.Remove(0, 12);
string n4 = s4.Remove(0,7);
Match m3 = Regex.Match(city, @"((www\.|(http|https|ftp|news|file)+\:\/\/)[_.a-z0-9-]+\.[a-z0-9\/_:@=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,| |>|<|;|\)])", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
string s5 = m3.Groups[1].Value;
if (m3.Groups[1].Value != s4 && m3.Groups[1].Value != n2 && m3.Groups[1].Value != n3&& m3.Groups[1].Value!=n4)
{
i2.Add(city);
inter.Add(s5);
count = 1;
}
}
if (count != 0)
{
AllLinks.Items.Add(s4);
}
Hrefs.DataSource = i2;
//AllLinks.DataSource = dates;
inter.RemoveAll(string.IsNullOrWhiteSpace);
ExternalLinks.DataSource = inter;
M Adeel Khalid
3-Apr-15 2:52am
View
don't be angry, thanks for replying.
M Adeel Khalid
3-Apr-15 1:16am
View
yeah! internet has many topics regarding this but none solution meet my requirement. It's become a headache. I'm confused on which basis I should differentiate them.
M Adeel Khalid
2-Apr-15 6:40am
View
Deleted
yeah! internet has many topics regarding this but none solution meet my requirement. It's become a headache. I'm confused on which basis I should differentiate them.
M Adeel Khalid
2-Apr-15 6:38am
View
the problem is, whenever i try to fetch external it also gets me internal, I'm stuck and don't know how to differentiate them and also on which basis. Really becomes a headache.
M Adeel Khalid
2-Apr-15 1:14am
View
thank you for your reply.
M Adeel Khalid
29-Nov-14 15:59pm
View
i followed what you mentioned, still error.. :(
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Book_BookPublisher". The conflict occurred in database "lms", table "dbo.BookPublisher", column 'BookPublisherId'.
The statement has been terminated.
M Adeel Khalid
29-Nov-14 14:45pm
View
BookAuthor =Table
BookAuthorId int NotNull
BookId int NotNull
AuthorId int NotNull
BookPublisher =table
BookPublisherId int NotNull
BookId int NotNull
PublisherId int Not Null
Author =Table
AuthorId int notNull
AuthorName varchar notNull
Publisher = table
PublisherId int notnull
PublisherName Varchar notNull
M Adeel Khalid
29-Nov-14 14:42pm
View
Sorry, i don't know how to create Script. I post my table here.
Table Name= Book
BookId int NotNull
BookTitile varchar NotNull
BookEdition varchar NotNull
BookQuantity varchar NotNull
BookStatus int NotNull
BookAuthorId int NotNull
BookCategoryId int NotNull
BookPublisherId int NotNull
M Adeel Khalid
29-Nov-14 14:27pm
View
Kindly give me your e-mail id, i'll post my whole database to you, then you'll clearly understand my guide and i'm 100% sure, you'll guide me in a better way.
M Adeel Khalid
29-Nov-14 14:21pm
View
you are right but BookPublisher table contains 2 foreign keys(BookId and PublisherId) which are not null, i also have to insert in that table. Tell me how can i insert only BookPublisherId without having need to insert in it's foreign keys. It also gives an error.
M Adeel Khalid
29-Nov-14 14:21pm
View
Deleted
you are right but BookPublisher table contains 2 foreign keys(BookId and PublisherId) which are not null, i also have to insert in that table. Tell me how can i insert only BookPublisherId without having need to insert in it's foreign keys. It also gives an error.
M Adeel Khalid
29-Nov-14 14:18pm
View
How to update query which works perfectly?
i did the following...
db.executequery("insert into Book(BookTitle, BookEdition,BookQuantity,BookStatus)Values('"+tb1.text+"','"+tb2.text+"','"+tb3.text+"','1') ")
dataset ds.executedataset("Select Scope_Identity()As expr1 from Book");
int i=convert.int32(ds.tables[0].rows[0][0].tostring());
db.executequery("Insert into BookPublisher(BookId,PublisherId)Values('"+i+"',cb1.selectedvalue)");
BookPublisher Id is set to autoincrement, still giving same error.
M Adeel Khalid
29-Nov-14 14:03pm
View
Sorry, it was my first time to post here, that's why i asked wrongly.
I've tried scope identity as per your suggestion but it still giving me the same error. I'm inserting 3 values in book and try to get the book id for the bookauthor table where i used to enter book id and author id(selected value from combobox). It took whole day to solve this problem but still stands. :( i'm very much disappointed.
M Adeel Khalid
29-Nov-14 13:47pm
View
I've checked scope identity(), it doesn't show any error while i checked the query. Problem is mentioned below.
"Cannot insert the value NULL into column 'BookPublisherId', table 'lms.dbo.Book'; column does not allow nulls. INSERT fails.
The statement has been terminated."
it means the recently added bookId is not fetched correctly. :(
M Adeel Khalid
29-Nov-14 13:23pm
View
My DB class has 2 methods, 1 for executequery(insert statements), 2nd for executedataset(select statements), i'm using SQLServer which is built in Visual Studio 2010, scope identity() could be a built in function of sql server but not supported in Visual studio's own SQl. Any suggestions?
Show More