|
In an existing vb.net 2010 application, I would like to create an email message for selected users using outlook 2013 and/or webmail that is supported by office 365. This email message would be generated when a user clicks a button to have a 'letter' generated. This email message would be generated when duplicate rec ords are located in the sql server 2012 database. The duplicate records should not occur in 99% of the cases but there is a chance the duplicate record can happen.
Thus would you show me the code on how to generate this email message?
|
|
|
|
|
|
Hello !
I have a sql server database ( the model ).
I have another sql server database.
I want to compare the second database with the model , and after to update the database structure in order to be equal with the model.
Is there any way to do this with VB.net
Thank you !
|
|
|
|
|
Yes but it is probably beyond your skill set at the moment. You might want to get SQL Compare from Red-Gate to give you an idea of the scope of this requirement. Red-Gate is not free but they are good, you might find some free tools to do a similar job, you might search Free Tools Discussion Boards[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I don't want a tool to make this work.
I know the redgate sql compare. But I think this tool work as a standalone program.
I need a library or a way to do this through code inside my vb.net program.
|
|
|
|
|
|
Thank you , but I'm not using Entity Framework on my program.
Do you think I can use this only for comparing databases and reflect changes ?
|
|
|
|
|
Have some google foo[^] it looks like there are quite a few examples there, even one from CP.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You can automate this with SQL Compare within a VB.NET program. There is a Compare SDK that can be embedded into an application.
SQL Comparison SDK - Automates Comparison And Synchronization Tasks[^]
The process of comparing two tables and generating difference code isn't hard, but it does become tedious as there are a lot of potential issues to work through. If you have lots of time to build this, then you can use data from sys.columns and other DMVs to generate difference lists and build the ALTER statements for tables.
For views/procs/functions, it's more complex comparing changes, but really if you have a model, you can just take the code and move it over.
|
|
|
|
|
Hello !
Using vb.net , how can I search and list the sql server instances running on local Pc and on local network ?
For each sql server instance I need to know the server name and database instance name.
Thank you !
|
|
|
|
|
|
Thank you !
But , is this going to work with other version of sql server for example 2012 , 2014 or 2016 ?
|
|
|
|
|
|
Yes I've tried it.
But on my Pc i have sql server 2008. On network i have sql server 2014 and 2016.
The code only work for sql server 2008 . Does not work for Sql server 2014 and 2016.
|
|
|
|
|
|
Yes , does not work with sql server 2014 and 2016.
|
|
|
|
|
Hello !
I have a vb.net 2003 application.
I have a form when users can upload images ( .jpg ) from files or from scanners. When a image is inserted , a link is kept in a database as a record.
I want to keep this uploaded images in a format that can be opened only from my application and not by windows explorer.
Is there anything I can do ?
Thank you !
|
|
|
|
|
Encrypting the file content seems to be the very obvious choice.
You'll have to decrypt the content, of course, when you want to show these images.
|
|
|
|
|
Can you suggest to me an encrypting library that I can use or something else ?
( And to better clarify what I want , when the user upload the file , I want to save this file in some folder , but the user should not be able to open this file from windows explorer or from other programs, but only when he try to open from within my application )
|
|
|
|
|
Like hijacking the data?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Just Google for "VB.NET encrypt decrypt file". You'll come up with tons of examples.
|
|
|
|
|
In an existing vb.net 2010 application that accesses a sql server 2012 database, I only want to modify the exsiting sql to add a comment saying what
cs.attributeID = 2775 and cs.attributeID = 2771 means in the following sql right next to the line where the sql actually exists.
Const sql As String = "SELECT CS2775.Personid,SchoolYearValue,SchoolYearName,CS2775.StatusDateTime " _
& " from " _
& "(SELECT cs.Personid,cs.value as SchoolYearValue, cd.name as SchoolYearName , [date] AS StatusDateTime " _
& " FROM TEST.DBO.customstudent cs WITH (NOLOCK)" _
& " JOIN TEST.DBO.CampusDictiONary cd " _
& " ON cs.attributeid = cd.attributeID AND cs.value =cd.code" _
& " WHERE cs.attributeID = 2775 " _
& " GROUP BY personID, cs.value, cd.value,name,[date]) as CS2775 " _
& " LEFT JOIN (SELECT Personid,value as Edcounsel1CP, max([date]) AS StatusDateTime " _
& " FROM TEST.DBO.customstudent WITH (NOLOCK)" _
& " WHERE attributeID = 2771 " _
& " GROUP BY personID, value ) as CS2771 " _
& " ON CS2771.PersonID = CS2775.Personid " _
& " AND CS2771.StatusDateTime = CS2775.StatusDateTime " _
& " WHERE CS2775.Personid = @studentlink ; "
I want to make this change since I am adding more 2 attribute values to an extensive long list of existing attribute values. Management would
not let me change the existing sql since it is not cost effective.
The only thing I know what to do is to place the comments prior to the string assignment statement. Thus would you show me the code of how I can add
the comments I would like to place in the sql listed
|
|
|
|
|
Assuming you want the comments in VB, and not in the actual query:
However, if you're using Visual Studio 2010 or later, you don't actually need the line continuation character. You just need to move the & from the start of the line to the end of the previous line:
Const sql As String = "SELECT CS2775.Personid,SchoolYearValue,SchoolYearName,CS2775.StatusDateTime " &
" from " &
"(SELECT cs.Personid,cs.value as SchoolYearValue, cd.name as SchoolYearName , [date] AS StatusDateTime " &
" FROM TEST.DBO.customstudent cs WITH (NOLOCK)" &
" JOIN TEST.DBO.CampusDictiONary cd " &
" ON cs.attributeid = cd.attributeID AND cs.value =cd.code" &
" WHERE cs.attributeID = 2775 " &
" GROUP BY personID, cs.value, cd.value,name,[date]) as CS2775 " &
" LEFT JOIN (SELECT Personid,value as Edcounsel1CP, max([date]) AS StatusDateTime " &
" FROM TEST.DBO.customstudent WITH (NOLOCK)" &
" WHERE attributeID = 2771 " &
" GROUP BY personID, value ) as CS2771 " &
" ON CS2771.PersonID = CS2775.Personid " &
" AND CS2771.StatusDateTime = CS2775.StatusDateTime " &
" WHERE CS2775.Personid = @studentlink ; "
If you do want the comments to be part of the query, then you'll need to use SQL's multi-line comment syntax:
& " WHERE cs.attributeID = 2775 /* A comment */ " _
You can't use the single-line comment syntax, because your query is all on one line, and everything after the comment would also be commented out.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks that works well!
|
|
|
|