Quantcast
Channel: MySQL Forums - MySQL for Visual Studio
Viewing all 417 articles
Browse latest View live

Get ID after INSERT via MySqlDataAdapter (2 replies)

$
0
0
Hello,
I use Win-10 & C# via VS-E-2015 & Connector/NET 6.9.9

I want to add many rows 'at once' to a table.
For this I use 'MySqlDataAdapter' & 'MySqlCommandBuilder' & 'DataSet'
After many
* 'MyRow = MyDataSet.Tables[0].NewRow();'
* 'MyRow["age"] = currentAge;'
* 'MyDataSet.Tables[0].Rows.Add(MyRow);'
Finally I execute 'MyDataAdapter.Update(MyDataSet);'.
This part already works fine.


The question is:
In order to maintain a additional 'Reference-Table' I do need the automatically generated IDs (PRIMARY KEY) of the just produced data-row.
How can I get the new IDs?

Thanks for your help!

Visual Studio 2017 error during build:"MySql.Data, Version=8.0.11.0" could not be resolved because it was built against the ".NETFramework,Version=v4.5.2" framework. (no replies)

$
0
0
Hi all,

I've used the latest installer and installed MySQL for Visual Studio (1.2.8) and Connector/Net 8.0.11. I'm using Microsoft Visual Studio Community version 15.5.6 (.NET framework 4.7.02556).

I've added the connection to MySQL using the server explorer and run some scripts, no problems. However, when I add a reference to MySQL.Data.dll and try and execute some SQL using C#, I get the message below. Is this a known issue/bug? Any workarounds?

The primary reference "MySql.Data, Version=8.0.11.0, Culture=neutral, PublicKeyToken=<token>, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".

CreateIfNotExist ->'Incorrect usage of spatial/fulltext/hash index and explicit index order' (1 reply)

$
0
0
I am using Entity Framework with MySql and I am using the Code Fist strategy. I created the classes and the relations between them by coding the properties. The creation of the database fails. I get the error: 'Incorrect usage of spatial/fulltext/hash index and explicit index order'. There is no hind to retrace what exactly throws that error.

I reduced the amount of my classes to two. As soon as there is any navigation property, the same problem appears. I used [Key], [ForeignKey] annotations, I configured the relations with FluentApi modelBuilder.Entity<Entity>().HasKey(e => e.thisId) ... HasMany() ... but there is always the same issue.

I tried really hard to solve this issue. This is annoying. What am I doing wrong?

Microsoft SQL Server is very convenient in solving such issues and in producing error messages that are more exactly. I do not have any clue what is mentioned with 'Incorrect usage of spatial/fulltext/hash index and explicit index order'.

How to use the noinstall file of mysql-for-visualstudio? (no replies)

$
0
0
How to use the noinstall file of mysql-for-visualstudio?

Export the mysql db table data to .txt file (no replies)

$
0
0
Hi,

I am trying to export the data from mysql database table to .txt file using the vb.net. I'm getting error while conversion.Is there any code snippet for this which heps me to get the data into text format. I'm using mysql8.0 version.

Regards
B Teja

Can I develop in 64-bit and deploy in 32-bit? (no replies)

$
0
0
I need to migrate an application From Windows 7 32-bit to a Windows 10 Pro 32-bit. The current application uses MS SQL Server Compact Edition, which will not run on Windows 10 Pro. So I am considering moving over to MySQL Community Edition instead. But that leaves me with several questions:

I know that in Visual Studio I can do that, but I don't know about the MySQL Community Edition part.

So regarding MySQL can I develop on 64-bit development Windows 10 Pro PC and deploy on a 32-bit Windows 10 Pro Target PC? Or must I purchase a 32-Bit development Windows 10 Pro PC?

You have a usable connection already (no replies)

$
0
0
Good morning,
i'm not sure if this is the right area to post or maybe my problem is relate to the connector.
However, following instruction from a webpage i finally be able to get an Entity Data model of my database.
(MySql for Visual studio 2.0.5 -> then connector 6.9.10 -> then in the project by nuget entity framework 6.2.0 and adding references MySql.Data.dll and MySql.Data.Entity.EF6.dll)
Ok.
But after this, i can't have a working dataset from my database.
Following the wizard, after selecting the tables for the dataset (note that i can see tables correctly and all the fields)
it gives me this error:
You have a usable connection already
and after that another error (one for each table i choosed) that say that it is not possible to retrieve information about the table schema.
(I already insterted the command "devenv /updateconfiguration /log " by the Developer Command Prompt for VS2017 tool as suggested in another post.)

Do you know a combination of working solutions?
Any idea?
Thanks ;)

Entitiy Framework Wizard crashes (no replies)

$
0
0
Hi



I'm trying to generate a model from a MySQL Server. In the Wizard, after selecting the connection, the wizard just disappears and nothing is Generated.

I have Installed:

MySQL Workbench 6.3.10
MySQL for Visual Studio 1.2.8
Connector/NET 8.0.11

EF 6.1.3
MySql.Data 6.9.9

I've also added the provider line in the app.config

<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">

What might that be?

unable to install MySQL for VisualStudio (no replies)

$
0
0
I have installed Visual Studio Community 2017.
When I try to install MySQL for Visualstudio 1.2.7 thru MySAL-Installer or MySQL for Visualstudio 1.2.8 with the msi-File, I always receive the error
"Visual Studio 2012, 2013, 2015 or 2017 must be installed."

accessing data in python applicatio (no replies)

$
0
0
Ive successfully connected mysql to Visual studio with the 'MySQL for visual studio' and 'Connector/Python' add ons. I am able to see my database connection in the server explorer and open tables within the database. However i am struggling to be able to make the connection within my written code (i need to run algorithms on the data). My inital idea was to create a dataframe with all the data and run algorthims on that. I ran the following code:

engine=create_engine('mssql+pyodbc://'+servername+'/'+database)
conn=engine.connect()
metadata=MetaData(conn)
tbl=Table(tablename,metadata,autoload=True,schema='dbo')
sql=tbl.select()
result=conn.execute(sql)
df=pd.DataFrame(database=list(result),columns=result.keys())
conn.close()

and received an sqlalchemy interface error- data source name not found and no default driver specified.

I also tried:

engine=sqlalchemy.create_engine('mysql+mysqlconnector://Localhost(databasename)/Table/new_event_data')
the_frame=pd.read_sql_query("SELECT * FROM %s;" %new_event_data, engine)
the_frame=pd.read_sql_table(new_event_data, engine)

which resulted in an error of 'new_event_data' is not specified.

There seems to be an issue making the connection between my code and the data. The full path for the data from the mysql database which was imported into visual studio is : DataExplorer://Localhost(databasename)/Table/new_event_data

Any tips on getting the data into a suitable format to access in ML algorthims? eg dataframe etc. Many thanks.

Adding a project data source error visual studio (no replies)

$
0
0
Whenever I try to add a new data source to my project, I get a could not retrieve schema information error. I am connecting to a mySql server through visual studio. I am connected to it in the server explorer. I have tried to connect in a different project with the same result. I have also tried re-installing visual studio, the connector, and clearing logs.

I've been trying to trouble shoot this for about a week with no success, any help would be appreciated!

VS17 EntityFramwork stuck at wizard step 3 (no replies)

$
0
0
Hello everybody,
I'm stuck with the ADO.Net Entity Data Model.I use the Visual Studio 2017 (v 15.7.5) Community, MySQL Connector Net 8.0.11, and MySQL for Visual Studio 2.0.5.


In a new WPF project with MVVM Light (WPF451), I changed the target framework to 4.6.1 and with NuGet installed
Entity Framework 6.2.0,
MySQL.Data 8.0.11,
MySQL.Data.Enities 6.8.3,
MySQL.Data.Entity 6.10.3.

Now I add a ADO.NET Entity Data Model to the Project with Code first from DataBase and select the Data Base Connection.

When I click Next, the error "Your project references the latest version of the Entity Framework, however, comes to Entity Framework database provider compatible with this version could not be found for your data connection ...".

If I change the etityFramework entry as follows, in the app.conf File.
<EntityFramework>
<defaultConnectionFactory type = "MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<Providers>
<provider invariantName = "MySql.Data.MySqlClient" type = "MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</ Providers>
</ EntityFramework>

Then the EF6 is recognized, but the wizard crashes without an error message.

What else needs to be done to make it work?

HOW TO WORK WITH TRIGGERS AND ITS TYPES IN SQL? (no replies)

$
0
0
TRIGGERS
A trigger is a special method of stored procedure and it invokes automatically when an event starts in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a table or view.

TYPES OF TRIGGERS
Triggers contain three types as follows;

DML Triggers
DDL Triggers
Logon Triggers
DML TRIGGERS
DML stands for Data Manipulation Language. INSERT, UPDATE, and DELETE statements are DML statements. DML triggers get fired whenever data is modified using INSERT, UPDATE, and DELETE events.

DML triggers can be again classified into 2 types.

1. After triggers (Sometimes called FOR triggers)

2. Instead of triggers

AFTER TRIGGERS
After triggers get fired after only with a condition when a modification action occurs. The INSERT, UPDATE and DELETE commands because of an after trigger gets fired after the execution of a complete statement.

Therefore, we need to use tblEmployee and tblEmployeeAudit tables for further examples as follows;

SQL Script to create tblEmployee table:



Finally, the table will look like as below;



SQL Script to create tblEmployeeAudit table:



Once a new Employee is added to the table in the database. Now, I want to retrieve the ID, date and time, the new employee is added to the tblEmployeeAudit table. The easiest way to get the same result by using an AFTER TRIGGER for INSERT event.

AFTER TRIGGER FOR INSERTION
Example for AFTER TRIGGER for INSERT event on the tblEmployee table as follows;



After this, we will get the id from inserted table name. So, the question arises, what is the role of an inserted table? An Inserted table defines a table which is mainly used by DML triggers. Once a time, you add a new row to the tblEmployee table, similarly, a row will generate the same copy in the inserted table, where only a trigger can access through the function. Further, you will not be able to access this table outside the context of the trigger function. The structure of the inserted table must be identical to the structure of the tblEmployee table.

So, if we execute the following INSERT command on tblEmployee. Simultaneously, after inserting the row data into the tblEmployee table, then the trigger gets fired as it gets invoked automatically, and the same row inserted into the tblEmployeeAudit table.

Insert into tblEmployee values (7,’Tan’, 2300, ‘Female’, 3)

when a row deletes records from the table tblEmployee.
Example for AFTER TRIGGER for DELETE event a tblEmployee table:



AFTER UPDATE TRIGGER
Triggers work with two organized tables, INSERTED and DELETED. Newly updated data stored in the inserted table and old specific data stored in the deleted table. After triggering for UPDATE event makes use of both inserted and deleted tables.

Create AFTER UPDATE trigger script:



So, execute the query:
Update tblEmployee set Name = ‘Tods’, Salary = 2000, Gender = ‘Female’ where Id = 4

Furthermore, after the UPDATE command execution, the AFTER UPDATE trigger gets fired, and you see the contents of INSERTED and DELETED tables and stores the audit data in tblEmployeeAudit table.







INSTEAD OF INSERT TRIGGER
As we well know that AFTER triggers get fired after the triggering action (INSERT, UPDATE or DELETE events), whereas, INSTEAD OF triggers get fired instead of the triggering action (INSERT, UPDATE or DELETE events). In addition, INSTEAD OF Insert triggers makes use for correctly update views that are based on multiple tables.

So, we start with the base demo on Employee and Department tables. So, first, let’s create these 2 tables.

SQL SCRIPT TO CREATE TBLEMPLOYEE TABLE:
CREATE TABLE tblEmployee
(
Id int Primary Key,
Name nvarchar(30),
Gender nvarchar(10),
DepartmentId int
)

SQL SCRIPT TO CREATE TBLDEPARTMENT TABLE:
CREATE TABLE tblDepartment
(
DeptId int Primary Key,
DeptName nvarchar(20)
)



So, we have our two required tables, let’s create a view which is based on these two tables, it will fetch the records of Employee Id, Name, Gender and DepartmentName columns. Therefore, the view is based on multiple tables.

SCRIPT TO CREATE A VIEW:
Create view vWEmployeeDetails
as
Select Id, Name, Gender, DeptName
from tblEmployee
join tblDepartment
on tblEmployee.DepartmentId = tblDepartment.DeptId

Once you execute this line, Select * from vWEmployeeDetails, It will retrieve all the records from the table as follows;



So, let’s insert a single row into the view function, vWEmployeeDetails, by running the following query. At this moment, it will throw an error like “View or function vWEmployeeDetails is not updatable because the modification affects multiple base tables.”

Insert into vWEmployeeDetails values (7, ‘Valarie’, ‘Female’, ‘IT’)

Finally, we inserted a row above into a view which is based on multiple tables, it gives an error by default. Now, let’s have a look into this, how INSTEAD OF TRIGGERS give us help in this condition. Since we are facing an error, when we try to insert a single row into the view function, let’s make an INSTEAD OF INSERT trigger on the view vWEmployeeDetails.

SCRIPT TO CREATE INSTEAD OF INSERT TRIGGER:


So, let’s execute the insertion query as follows:

Insert into vWEmployeeDetails values (7, ‘Valarie’, ‘Female’, ‘IT’)

The instead of trigger inserts records wisely, the data records into the tblEmployee table. Since we are inserting the data records into the inserted table, which contains the newly added row data, whereas the deleted table contains empty.

In the trigger action, we used Raiserror() function to show a custom error, once the DepartmentName provides in the insert query, that does not exist. It passes three parameters to the Raiserror() method. The first one parameter shows the error message, and the second parameter shows severity level. Severity level 16, which indicates general errors that only accessible for user correction. The final parameter shows the state parameter.

INSTEAD OF UPDATE TRIGGER
An INSTEAD OF UPDATE triggers gets fired instead of an update event, that can be on a table or a view function. For example, let’s understand, an INSTEAD OF UPDATE trigger, and then when you try to make the update into the row within that view function or table, instead of the UPDATE, in this situation, the trigger get invoked automatically. Instead of update trigger based on multiple tables.

So, let’s create both the tables Employee and Department as follows.

SQL SCRIPT TO CREATE TBLEMPLOYEE TABLE:
CREATE TABLE tblEmployee
(
Id int Primary Key,
Name nvarchar(30),
Gender nvarchar(10),
DepartmentId int
)

SQL SCRIPT TO CREATE TBLDEPARTMENT TABLE
CREATE TABLE tblDepartment
(
DeptId int Primary Key,
DeptName nvarchar(20)
)



So, we have our required two tables, let’s create a view which is based on these two tables, it will fetch the records of Employee Id, Name, Gender and DepartmentName columns which are based on multiple tables.

SCRIPT TO CREATE THE VIEW:
Create view vWEmployeeDetails
as
Select Id, Name, Gender, DeptName
from tblEmployee
join tblDepartment
on tblEmployee.DepartmentId = tblDepartment.DeptId

Once you execute this line, Select * from vWEmployeeDetails, It will retrieve all the records from the table as follows;



In above example, when we inserted a single row into the view table and got an error statement like- ‘View or function vWEmployeeDetails is not updatable because the modification affects multiple base tables.‘

So, let’s quickly update the view function, in addition, it affects both the tables, and if we face the same error statement. Then, the UPDATE command changes its column “Name” from the table tblEmployee and column “DeptName” from the table tblDepartment. So, when we run this query, we face the same error.

Update vWEmployeeDetails
set Name = ‘Johny’, DeptName = ‘IT’
where Id = 1

So, let’s do some change in the department of John from HR to IT. The UPDATE query runs only one table and that is the tblDepartment table. So, the query may succeed. But, there is a condition before executing the query, please make note that employees name JOHN and BEN both are in HR department.

Update vWEmployeeDetails
set DeptName = ‘IT’
where Id = 1

After execution of the query, now select all data records from the view function, and note that BEN’sDeptName has also changed to IT. We also change JOHN’s DeptName. So, the UPDATE command did not work as we expected. Why it happened, because of the UPDATE query command, updated column name DeptName from HR to the IT, in the tblDepartment table. For an update, we need to change the DeptId of JOHN from 3 to 1.

INCORRECTLY UPDATED VIEW




In conclusion, if a view function is based on multiple tables, and if you ever update the view function in triggers, the UPDATE command may not always work as we expect. To resolve this situation, use Instead of Update trigger with a view function.

Before we create the trigger, let’s update the DeptName to HR for record with Id = 3.

Update tblDepartment set DeptName = ‘HR’ where DeptId = 3

SCRIPT TO CREATE INSTEAD OF UPDATE TRIGGER:




Now, let’s try to update department as “IT” and name “John”.
Update vWEmployeeDetails
set DeptName = ‘IT’
where Id = 1

The UPDATE query works as expected. The INSTEAD OF UPDATE trigger works correctly, and it changes john’s DepartmentId to 1 in the tblEmployee table.

So, let’s try to update in columns Name, Gender, and DeptName. An Update query works properly but it will not give you an error like – ‘View or function vWEmployeeDetails is not updatable because the modification affects multiple base tables.’

Let’s do the quick update on the views table “vWEmployeeDetails”

Update vWEmployeeDetails
set Name = ‘Johny’, Gender = ‘Female’, DeptName = ‘IT’
where Id = 1

Hence, Update() function used in above example, which gives the result as “True”. It does not matter if you even update with the same value. This is why, I recommend the comparison of values with inserted and deleted tables, instead of using Update() function.

INSTEAD OF DELETE TRIGGER
An INSTEAD OF DELETE trigger gets fired in the state of the DELETE event on a table or a view. Let’s understand with an example. Let’s assume, an INSTEAD OF DELETE trigger on a view or a table, and when you try to update a single row from that view or table, in the state of a real DELETE event, then the trigger automatically gets fired. INSTEAD OF DELETE TRIGGERS only used to delete data in terms of records from a view or a table, which is based on multiple tables.

Let’s create two tables Employee and Department.

SQL SCRIPT TO CREATE TBLEMPLOYEE TABLE:
CREATE TABLE tblEmployee
(
Id int Primary Key,
Name nvarchar(30),
Gender nvarchar(10),
DepartmentId int
)

SQL SCRIPT TO CREATE TBLDEPARTMENT TABLE
CREATE TABLE tblDepartment
(
DeptId int Primary Key,
DeptName nvarchar(20)
)



Since we now have the required tables, let’s create a view based on these tables. And, this view will return Employee Id, Name, Gender and DepartmentName columns. So, the view is based on multiple tables.

SCRIPT TO CREATE THE VIEW:
Create view vWEmployeeDetails
as
Select Id, Name, Gender, DeptName
from tblEmployee
join tblDepartment
on tblEmployee.DepartmentId = tblDepartment.DeptId

Once you execute this line, Select * from vWEmployeeDetails, It will retrieve all the records from the table as follows;



In above example, when we inserted a single row into the view table and got an error statement like- ‘View or function vWEmployeeDetails is not updatable because the modification affects multiple base tables.‘

Although, when we tried to update a view which is based on multiple tables, we faced the same error. To get the error, it will affect both the base tables. If the update query affects only one base table, we do not get the error, but the UPDATE query does not work properly if the “DeptName” column gets updated.

Now, let’s try to delete a row from the view, and we get the same error.

Delete from vWEmployeeDetails where Id = 1

SCRIPT TO CREATE INSTEAD OF DELETE TRIGGER:
Create Trigger tr_vWEmployeeDetails_InsteadOfDelete
on vWEmployeeDetails
instead of delete
as
Begin
Delete tblEmployee
from tblEmployee
join deleted
on tblEmployee.Id = deleted.Id

–Subquery

–Delete from tblEmployee
–where Id in (Select Id from deleted)
End

Note: The trigger tr_vWEmployeeDetails_InsteadOfDelete applicable in DELETED table. But Deleted table contains all the rows that we tried to DELETE from the view. So, we join the DELETED table with table tblEmployee to delete the unwanted rows. In such cases, Joins are much faster than the subqueries.

When you execute the following DELETE command, the row gets DELETED as expected from tblEmployee table

Delete from vWEmployeeDetails where Id = 1

A small difference among the triggers as given below;



DDL TRIGGERS
DDL triggers is an operation that only gets fired in response to DDL events – CREATE, ALTER, and DROP (Table, Function, Index, Stored Procedure) these are the DDL triggers commands or we can say only DDL commands in SQL. System stored procedures, that perform DDL operations can also fire DDL triggers in the SQL commands.

Example – sp_rename system stored procedure.

WHY THE USE OF DDL TRIGGERS.
Triggers used for improvement in data integrity and liability of the database.
Triggers maintain Audit file and table structure in the database.
Syntax for creating DDL trigger as follows;

CREATE TRIGGER [Trigger_Name]

ON [Scope (Server|Database)]

FOR [EventType1, EventType2, EventType3, …],

AS

BEGIN

— Trigger Body

END

DDL triggers can be created in a database server.

The following trigger will fire in response to CREATE_TABLE DDL event.

CREATE TRIGGER trMyFirstTrigger

ON Database

FOR CREATE_TABLE

AS

BEGIN

Print ‘New table created’

END

HOW TO CHECK TRIGGER HAS BEEN CREATED OR NOT?
Open your “Object Explorer window”, then further expand the “SampleDB” database by click on the plus symbol in near the folder name of SampleDB.
Then, expand Programmability folder.
Finally, expand Database Triggers folder. Please have a look at given image for reference as follows;


Please note: If you do not find the trigger that you just created, I suggest you refresh the Database Triggers folder.

When you execute the given code to just create the table, then the trigger automatically get fired and in return, it prints the message – New table created

Create Table Test (Id int)

The above trigger gets fired only for one DDL event which is “Create Table”. Furthermore, if you want that trigger to get fired with multiple events, let’s understand an example when you ever make your table in alter or drop commands, then separate the events by using a comma as follows.


ALTER TRIGGER trMyFirstTrigger

ON Database

FOR CREATE_TABLE, ALTER_TABLE, DROP_TABLE

AS

BEGIN

Print ‘A table has just been created, modified or deleted‘

END

So, now if you want to create, alter or drop a table, the trigger automatically gets fired and then you get the message like as – “A table has just been created, modified or deleted”.

The second DDL triggers perform some code to DDL events. So, let’s look at an example of how to save users from creating, altering or dropping tables. To get this you need to modify the trigger as given below.




To create, alter or drop a table, you either have to disable or delete the trigger. How do we get this, let’s understand the following checkpoints for disabling and enabling it.

HOW TO DISABLE TRIGGER?
First, Open your object explorer window on the left corner of your window screen, then do Right-click on the trigger and select option “Disable” from the context menu folder.
Further, you can also disable the trigger by using the T-SQL commands like as follows DISABLE TRIGGER trMyFirstTrigger ON DATABASE
HOW TO ENABLE TRIGGER?
First, Open your object explorer window on the left corner of your window screen, then do Right-click on the trigger and select option “Enable” from the context menu folder.
Further, you can also enable the trigger by using the T-SQL commands like as follows ENABLE TRIGGER trMyFirstTrigger ON DATABA
HOW TO DELETE TRIGGER?
First, Open your object explorer window on the left corner of your window screen, then do Right-click on the trigger and select option “Delete” from the context menu folder.
Further, you can also delete the trigger by using the T-SQL commands like as follows DROP TRIGGER trMyFirstTrigger ON DATABASE
System stored procedures that perform DDL operations can also fire DDL triggers. A given trigger gets fired once you rename a database object using “sp_rename” system stored procedure name. You can get your output by using this query.



In the given above code, that completely changes the name of the TestTable to NewTestTable. When you run this code, it will execute and it will get fire the trigger trRenameTable. For this reason, let’s have a look at given code as follows;

sp_rename ‘TestTable’, ‘NewTestTable’

In the given above code, that completely changes the name of the “Id” column in NewTestTable to NewId.When you run this code, it will execute and it will get fire the trigger trRenameTable. For this reason, let’s have a look at given code as follows;

sp_rename ‘NewTestTable.Id’ , ‘NewId’, ‘column’

LOGON TRIGGERS
Logon triggers is an operation that only gets executed automatically in response to a LOGON event. These triggers get fired only after the log finishes in the authentication phase but user session must be established before. Moreover, you will learn about why we use logon triggers.

WHY WE USE FOR LOGON TRIGGERS
Below are some meaningful cases in logon triggers

For tracking login activity in the database.
To restrict logins authority to SQL Server programs.
To restrict the number of sessions for a specific login.
Let’s understand with a Logon trigger example: Trigger sets limits of the maximum number of open connections with a user to 3.


As a result, trigger error message gets straight to the error log window. Then, execute the given command to read the error log.

Execute sp_readerrorlog

CONCLUSION
In this article, I described all the various types of Triggers like DDL, DML, and Logon. It is very useful to maintain the data integrity constraints in the database in the absence of SQL constraints keys (primary key and foreign key). Triggers is much useful feature of SQL/T-SQL and you can also use it in Oracle.

Moreover, Triggers control update format on which update allows the database. Triggers play a vital role in calling stored procedures. It is useful in the corporate sector to maintain the track of all the employees’ record which need to be changed like (update, deletion, and insertion) in the tables.

VS2017 MySQL Web Configuration Tool Error: MySQL.ConnectorInstaller (4 replies)

$
0
0
I am using Visual Studio 2017 Professional. I have MySQL for Visual Studio 1.2.7 and Connector/NET 6.10.4 installed.

Using the Server Explorer I am able to connect to the MySQL Database. However, when I attempt to use the MySQL Web Configuration Tool, I get the following error:
Could not load file or assembly "MySQL.ConnectorInstaller,
Version=6.10.4.0 Culture=neutral, PublicKeyToken=c5687fc88969c44d'
or one of its dependencies. The system cannot find the file specified.

Also, when I attempt to connect a new version of ADO.Net Entity Data Model, MySQL Database is not in the Data source list.

Mysql option missing in data source provider with Visual studio 1.2.8 (no replies)

$
0
0
I have installed Mysql Extensions for visual studio with the MySQL Installer 8.0.12 https://dev.mysql.com/downloads/installer/ but I cannot find any MySQL connection in Data Source Selector.

The bellow addons has been installed.
Mysql for Visual studio version 1.2.8,
Mysql Connector/Net 8.0.12,
Connector ODBC/8.0.12

How to Repeat:
1. Open Visual Studio and Right Click on Data Connection in Server Explorer.
2. Select ‘Add Connection’
3. Choose ‘Others’ from Data Sources.

Issue: The MySQL value is missing in both : Data Provider drop down neither and Data Source list.

Can't create DataSet from Visual Studio 2017 with MySQL for Visual Studio 1.2.8 (no replies)

$
0
0
Hi, I'm a software developer I've been using MySQL and Connector.NET for my projects in .NET using Visual Studio for MySQL . So far I have had no problems, but now that I upgraded to Visual Studio Community 2017 and to Visual Studio for MySQL 1.2.8, I can not get it to work well .

When I try to add a data source through the Dataset wizard that lets you choose your database objects, I do the test connection and it works but at the end I get a error message from Microsoft Visual Studio:

"Some updating commands Could not be generated Automatically. The database returned the following error: Unexpected Error. "

Can you help me fix it?

Missing Server and User in Credentials (1 reply)

$
0
0
I'm using VS 2017, and i'm trying to create a model with and Entity Data Model, but as soon as the page where i should selecte the database this message comes in "Missing Server and User in Credentials" and if i try to create a new connection, i fill everything, localhost, root, the password, select the database, even i test the connection before, but when i continue it says that the password was not found in the dictionary.

If i work in a project that already has a model, i can update it, erase all the tables and add them again.

The problem only occurs when i try to add a Model.

Visual Studio 2017
MYSQL Server 5.7.22
MYSQL for Visual Studio 2.0.5 CTP
CONNECTOR/NET 6.9.8

that's what i'm using, a coworker has the same setting apparently but he can create Models.

Copiar registros en otra tabla (no replies)

$
0
0
Hola buen día. Tengo conocimientos básicos en C# y en bases de datos. Tengo por hacer la siguiente práctica. Tengo dos tablas idénticas en distintas bases de datos y debo comparar con el código del producto "COD_Prod" los códigos que están en tabla A pero que no están en tabla B, mostrarlos en un grid y posteriormente enviarlos a la tabla B, de tal modo que tengan los mismos códigos. Siempre se actualizan de la tabla A a la tabla B, ya que siempre se dan de alta mediante sistema en tabla A. Mi base de datos está en Mysql y si existen herramientas o tips que me puedan dar para inventigar. Gracias por su apoyo. Saludos cordiales

Lentitud conexión MySQL y .NET (no replies)

$
0
0
Tengo un sistema desarrollado anteriormente en VB6. Lo hemos estado pasando a VB.NET y está muy lento y no se porque.

Hice una prueba comparando la velocidad entre MSSQL y MySQL. Actualicé 5,000 registros de una tabla el resultado fue:

MSSQL -> 43 Segundos
MySQL -> 10 Minutos y 36 Segundos

La diferencia es exagerada. Al parecer, el tema viene con la conexión entre .NET y MySQL, porque cuando hago la conexión entre VB6 y MySQL, la velocidad es muy buen, al igual que .NET y MSSQL.

Tienen alguna idea del porque es tan lento las transacciones entre .NET y MySQL?

La librería que estoy utilizando para conectado a MySQL es MySql.Data.MySqlClient .Net Core Class Library Versión 8.0.12

El conection string utilizado es: server=localhost;user id=root; password=MiClave; database=dbContab; pooling=false; Allow User Variables=True; SslMode=none

Advanced SQL Generation Options Disabled (no replies)

$
0
0
Hi All,

Using
- Visual Studio 2017
- MySQL for VS 2.05
- MySQL Connector .net 6.9.9

Been trying to create a datasource for my AspxGridView employing the use of the Advanced SQL generation options which seem to be "Greyed" out. Since the table(which HAS a primary key) contains 50 fields, this method would obviously be more convenient than manually writing the Update statement with parameters.
*Note: I am able to have success when working with my local MySQL(v5.6.38) but the above issue occurs working with our production MySQL(v8.0.12)

My question is how do I solve to work with the newer MySQL version?
Do I require some updates?

Any help is greatly appreciated

Patrick
Viewing all 417 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>