I've been trying to find out how to find the preferred network connection (ex: WAN or LAN). There's a way to change the connection order in windows, but it doesn't seem like there are WMI classes that contain this connection order. Anyone know where to look/how to find the preferred connection?
TheFM234
Posts
-
How to get default/perferred Network Connection -
Settings a webusercontrol object's propertyI'm trying to add a webusercontrol I've created dynamically through a page. I have the properties all set up correctly, and those are working. What happens when the Page_Load is that the labels that I have in the control are still null when the Page_Load runs, so a NullReferenceNotHandled exception is thrown when I try to access a label's Text property. What am I doing wrong? Maybe I'm using the webusercontrol in the wrong way, I'm used to writing desktop applications... He's the code I'm using, assume that I have the correct code for the properties
public NewsPost(string title, string date, string message, int newsId) { this.Title = title; this.Date = date; this.Message = message; this.NewsId = newsId; } protected void Page\_Load(object sender, EventArgs e) { lblTitle.Text = Title; //NullReferenceNotHandled error is thrown here lblDate.Text = Date; lblMessage.Text = Message; }
-
Thread question ?The background worker cannot directly access other controls not on it's own thread. What you can do is use the ReportProgress method along with the ProgressChanged event from the BackgroundWorker object. If your using a progress par, you can pass a percent value into ReportProgress(int) from the thread that the background worker is on, and update the value of your progress bar from the ProgressChanged event. There are many articles online about this objects, so search those for syntax and structure ideas.
-
Union query.. I guess:)You would use a join for this. Select * From City_Info i Inner Join City_Population p on p.City_Id = i.City_Id The output should be similar to:
City_Id City_Name City_Id City_Population
1 First City 1 100
2 Second City 2 200
3 Third City 3 300You probably wouldn't want City_Id two times, so you would need to specify the columns that you want in the select list. Be sure to qualify the column names so you don't get an ambiguous column error (ex:
i.City_id, i.City_Name, p.City_Population
). -
Thread question ?If your doing this process from a UI, I suggest researching BackgroundWorkers. If your making a service, then check out the System.Threadding namespace.
-
How to save something in memory to file?You might be able to use xml serialization to save and load the binary tree.
-
How to prevent adding a duplicate value into a tableYou can add an unique index on the name column.
-
ProgressBar in multi-threaded applicationThere is a method that background workers have that is called "ReportProgress", and a event called "ProgressChanged" that triggers when the ReportProgress method is called. You can access the ProgressChanged from the original thread, unlike trying to directly access the progress bar via
progressbar.value = x
. -
tableI think you are looking for something like declare @my_table as table (id int,f_name varchar(50),l_name varchar(50)) insert into @my_table (id, f_name, l_name) select id_user, first_name, last_name From dbo.users
-
"Neat-a-fying" a huge query [modified]You might want to go after the SSIS package approach. It might take longer to create, but it is a lot easier to maintain with larger projects. You might need to ask yourself will you be saving the time in the future by using SSIS?
-
between max() and min()Select Max(id)
Fromtable
where id != (Select Max(id) Fromtable
)The above will give you the second maximum id.
-
Enum / Cast QuestionAs Greeeg said above, there is no implicit conversion for a enum into an int. All conversions need to be done explicitly. Just a question/though about your base class: why are you storing the enum as an int? I think for program clarity and maintainability, storing EmployeeType as the enum type would be the best way to go (and it will be more clear if your going to have an object out of the base).
-
Unsigned data type.There is no unsigned integer types in SQL Server, except for tinyint (0 - 255). You can use an user defined data type, but that will not make the size of the data smaller (which is what I'm assuming you want to do). You can also add a constraint to a column so the value is >= 0. As for saving space, no way to unsign an int.
-
How do i?I thought that at first, but it seems like a legit concept. I don't like flipping between a calculator and windows all the time.
-
A question about the DB constructionSomething that might happen in the future is that a business might need to have 2 types of schedules, causing duplicate data in the business table on every column but ScheduleId. You could "map" BusinessId's to SchedulesId's in a view, so you might have tables like: BusinessID, Name, ... ScheduleId, Day, StartTime, EndTime Mapping Table: BusinessId, ScheduleId (with a unique index on BusinessId, ScheduleID so you don't dupe data) Then have a view
Select ... From MappingTable m Join ...
But if you have a business rule similar to one business can have one schedule per day, then I think your Joined solution will work fine. -
T-SQL Help [modified]I copied and pasted the two queries you supplied into the join sub-query syntax, so the line 11 one is something from the query you supplied (and I'm guessing the second one is resulting from the first error). To try to clear things up for you, here's a simple structure of a sub-query join:
Select
<select list>
From
(
<query 1>
) q1
Join
(
<query 2>
) q2 on
<join list>
<other clauses (probably will not have any here)>The select must use the names assigned to the columns, so if you have Select Name, Date as OpenDate; then you would need to use Name for name (because the name was not changed) and OpenDate for the original column Date. If you think of the two queries as tables, it might make the concept easier to grasp. If the above query was written from tables, it would be
Select * From Table1 q1 Join Table2 q2 on ...
Hope that helps. -
T-SQL Help [modified]If your queries return the correct data by themselves, then you should be able to join on a subquerys:
Select
total.Cient
,TotalTicketsAssigned
,TotalClosedForRange
From
(
select count(*) as 'TotalTicketsAssigned' , location_name 'Cient'
from job_ticket j
inner join priority_type p on p.priority_type_id = j.priority_type_id
inner join tech t on t.client_id = j.assigned_tech_id
inner join location l on l.location_id = j.location_id
WHERE Report_Date >= DATEADD(dd,-7,CONVERT(DATETIME,CONVERT(CHAR(8),
GETDATE(),112))) AND
Report_Date < DATEADD(dd,1,CONVERT(DATETIME,CONVERT(CHAR(8),
GETDATE(),112)))
group by l.location_name
) total
Left Join
(
select count(*) as 'TotalClosedforRange'
, location_name 'Cient'
from job_ticket j
inner join priority_type p on p.priority_type_id = j.priority_type_id
inner join tech t on t.client_id = j.assigned_tech_id
inner join location l on l.location_id = j.location_id
where (last_status_update_time >= DATEADD(dd,-7,CONVERT(DATETIME,CONVERT(CHAR(8),
GETDATE(),112))) AND
Report_Date < DATEADD(dd,1,CONVERT(DATETIME,CONVERT(CHAR(8),
GETDATE(),112))) ) and
status_type_id ='3'
group by l.location_name
) Closed on
total.Cient = closed.Cient -
Need help with View <noobie></noobie>Select AppName, Version, Sum(InstallCount)
From table
Group By AppName, Version
OrderBy AppName -
A question about the DB constructionI would suggest to accomplish this by using relational tables. Have a table with the business info, and then give the business an Id number. Create a table that has BusinessId,Day, TimeWorkStart, TimeWorkEnd, TimeLunchStart, TimeLunchEnd (or whatever you want to call them). The BusinessID would be the foreign key that would refer to the Business info table. To get the schedule, you would need to join up on the BusinessId of both tables. The way you listed above could be one approach (and I've seen similar things done in program), but you might come to a point where the design restricts you from adding additional schedules without storing a bunch of duplicate data. Also less data is being stored. If your table has 28 columns, but only has, say Monday and Tuesday workdays, then there are 20 unused columns.
-
mysql data typeBlob, which stands for Binary large object.