Click here to Skip to main content
15,915,336 members
Home / Discussions / C#
   

C#

 
GeneralRe: filesystem Pin
Sunil Wise9-Nov-07 23:59
professionalSunil Wise9-Nov-07 23:59 
QuestionFilling a typed dataset with multiple tables Pin
steve_rm9-Nov-07 22:59
steve_rm9-Nov-07 22:59 
AnswerRe: Filling a typed dataset with multiple tables Pin
Paul Conrad10-Nov-07 4:37
professionalPaul Conrad10-Nov-07 4:37 
QuestionRe: Filling a typed dataset with multiple tables Pin
steve_rm10-Nov-07 6:13
steve_rm10-Nov-07 6:13 
AnswerRe: Filling a typed dataset with multiple tables Pin
Paul Conrad10-Nov-07 6:38
professionalPaul Conrad10-Nov-07 6:38 
QuestionDynamically Printing a bitmap image Pin
sindhutiwari9-Nov-07 22:57
sindhutiwari9-Nov-07 22:57 
AnswerRe: Dynamically Printing a bitmap image Pin
Matthew Butler10-Nov-07 1:37
Matthew Butler10-Nov-07 1:37 
QuestionSqlNotificationRequest Problem. Pin
hdv2129-Nov-07 21:51
hdv2129-Nov-07 21:51 
hi i create a queue and service in my sql server 2005 by this code :

create queue myNotificationQueue
create service myService on queue myNotificationQueue

in my csharp code i wrote this code :
class Program
{
string connstring = null;
SqlConnection conn = null;
SqlDataReader rdr = null;

static void Main(string[] args)
{
Program c = new Program();
c.connstring = @"Data Source=MYLAPTOP\SQLLAPTOP;Initial Catalog=pubs;persist Security Info=True;User ID=sa;password=1";
c.conn = new SqlConnection(c.connstring);
c.DoWork();
Console.ReadLine();
}

private void DoWork()
{
conn.Open();
rdr = GetJobs();
if (rdr != null)
{
rdr.Close();
WaitForChanges();
}
conn.Dispose();
}

public SqlDataReader GetJobs()
{
using (SqlCommand cmd = new SqlCommand("Select job_id, job_desc from dbo.jobs", conn))
{
try
{
//cmd.Parameters.AddWithValue("@id", JobId);
SqlNotificationRequest not = new SqlNotificationRequest();
not.UserData = Guid.NewGuid().ToString();

// this must be a service named MyService in the pubs database
// associated with a queue called notificationqueue (see below)
// service must go by QueryNotifications contract
not.Options = "service=myService;local database=pubs";
not.Timeout = 0;

// hook up the notification request
cmd.Notification = not;
rdr = cmd.ExecuteReader();
while (rdr.Read())
Console.WriteLine(rdr[0]);
rdr.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return rdr;
}
}

public void WaitForChanges()
{
// wait for notification to appear on the queue
// then read it yourself
using (SqlCommand cmd = new SqlCommand("WAITFOR (Receive convert(xml,message_body) from myNotificationQueue)", conn))
{
cmd.CommandTimeout = 0;
object o = cmd.ExecuteScalar();

// process the notification message however you like
Console.WriteLine(o);
}
}
}

but when i compile it, and change jobs table, nothing occured. where does my problem ?
& How to solve my problem ?
thanks
AnswerRe: SqlNotificationRequest Problem. Pin
sindhutiwari10-Nov-07 0:30
sindhutiwari10-Nov-07 0:30 
QuestionNow it is Official... I need help! Pin
kingletas9-Nov-07 20:22
kingletas9-Nov-07 20:22 
AnswerRe: Now it is Official... I need help! Pin
Christian Graus9-Nov-07 22:01
protectorChristian Graus9-Nov-07 22:01 
GeneralRe: Now it is Official... I need help! Pin
kingletas9-Nov-07 22:14
kingletas9-Nov-07 22:14 
GeneralRe: Now it is Official... I need help! Pin
Christian Graus9-Nov-07 22:20
protectorChristian Graus9-Nov-07 22:20 
GeneralRe: Now it is Official... I need help! Pin
Paul Conrad10-Nov-07 3:18
professionalPaul Conrad10-Nov-07 3:18 
GeneralRe: Now it is Official... I need help! Pin
kingletas10-Nov-07 15:34
kingletas10-Nov-07 15:34 
GeneralRe: Now it is Official... I need help! Pin
Paul Conrad10-Nov-07 16:10
professionalPaul Conrad10-Nov-07 16:10 
GeneralRe: Now it is Official... I need help! Pin
Guffa9-Nov-07 23:06
Guffa9-Nov-07 23:06 
QuestionBrowser control in C# 2.0 Pin
A.Asif9-Nov-07 19:41
A.Asif9-Nov-07 19:41 
AnswerRe: Browser control in C# 2.0 Pin
Rajasekharan Vengalil9-Nov-07 20:18
Rajasekharan Vengalil9-Nov-07 20:18 
GeneralRe: Browser control in C# 2.0 Pin
A.Asif9-Nov-07 20:44
A.Asif9-Nov-07 20:44 
GeneralRe: Browser control in C# 2.0 Pin
Christian Graus9-Nov-07 22:44
protectorChristian Graus9-Nov-07 22:44 
GeneralRe: Browser control in C# 2.0 Pin
A.Asif11-Nov-07 17:15
A.Asif11-Nov-07 17:15 
QuestionHow to create resizable controls Pin
A.Asif9-Nov-07 19:40
A.Asif9-Nov-07 19:40 
AnswerRe: How to create resizable controls Pin
Rajasekharan Vengalil9-Nov-07 20:19
Rajasekharan Vengalil9-Nov-07 20:19 
GeneralRe: How to create resizable controls Pin
A.Asif9-Nov-07 20:43
A.Asif9-Nov-07 20:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.