![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Mar 2005
Posts: 15
Rep Power: 0
![]() |
Search Engine
Hey guys i am very n00b at c# at the moment but i am currently in the process of creating a C# program for a school assignment. In this assingment the program must be able to connect to a database then search through what even information i put in it. i am asking you guys if you have done this before? Creating the search engine or know of tutorials i can go to and ave a look please because i am really confused.
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
Have you been able to connect to the database? Cause after that it's just a matter of some sql.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#3 |
|
Programmer
|
C# & ASP.NET is exciting!
Samsonite:
Sounds like a very interesting assignment...one that can be developed more and more as you go on. I agree with Pizentios, that once you get connected it's just a matter of being clever with some SQL algorythyms. Myself, I would try implementing Web Services in some way as well, but that's just me, and may not be part of your assignment. Are you having any difficulty with any particular part of the App? Where do you go to school? I am currently attending NAIT( The Northern Alberta Institute Of Technology ) in Edmonton, Alberta, Canada, and I am enjoying it. Sincerely, Kevin Parkinson Last edited by new User(Kevin.Parkinson); Mar 24th, 2005 at 9:52 PM. Reason: Misspelled words, and I like to format |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Mar 2005
Posts: 15
Rep Power: 0
![]() |
i am in high school grade 12 at the moment and i cant get it to work... i have to create the program in Microsoft visual studios .net 2003 any tutorials or examples would really help please send to samsonite87@gmail.com
thankyou sam moohin |
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() |
try posting some code, some us might be able to give you some pointers.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Mar 2005
Posts: 15
Rep Power: 0
![]() |
thats the thing i dont know where to start!
like i dont even know what sql command to use to search through the database finding each item that starts with M ete becasue the data base consists of 3 tables, 1, moVIES, 2. Games and 3 Music and database is claled assignment ive been findeling around with iht but im still not getting anywhere |
|
|
|
|
|
#7 |
|
Programming Guru
![]() |
Ask your tutors and read the books and notes you should have from your classes then try some code then get back to us and we will help.
|
|
|
|
|
|
#8 |
|
Programming Guru
![]() ![]() |
here's some sql that i would use.
SELECT * FROM movies WHERE item LIKE 'M%' then if you wanted to automate the deal, just have a array with the three table names in it. Then put a for loop around it. then replace the table with the varible. so something like this: //var declair
string sql;
string[] tables = new string[2];
tables[0] = "movies";
tables[1] = "games";
tables[2] = "music";
//now we need the for loop:
for (int x=1; x<2; x++)
//now to build the sql string
sql = "SELECT * FROM " << tables[x] << " WHERE item LIKE 'M%'";
//then do your select here, i would use another array to hold the results from each select statment.
//then display the search results here.did that help you get started?
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#9 |
|
Programming Guru
![]() ![]() ![]() |
code to connect to a MySQL database via ByteFX and C#
using System;
using System.Data;
using ByteFX.Data.MySqlClient;
public class Test
{
public static void Main(string[] args)
{
string connectionString =
"Server=SERVERNAME.com;" +
"Database=DBNAME;" +
"User ID=USERID;" +
"Password=PASSWORD;";
IDbConnection dbcon;
dbcon = new MySqlConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
string sql =
"SELECT firstname, lastname " +
"FROM test";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
string FirstName = (string) reader["firstname"];
string LastName = (string) reader["lastname"];
Console.WriteLine("Name: " +
FirstName + " " + LastName);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
}
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#10 |
|
Newbie
Join Date: Mar 2005
Posts: 15
Rep Power: 0
![]() |
Okay thanx guys that has really helped ill go muck around with it now
ill host it up later on when i get stuck (prolly soon ) thanx very much |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|