Home » Archive by category ".NET 4.0" (Page 2)

Archive for the '.NET 4.0' Category

VB.NET – User Impersonation

Application Error: “ASP.NET  v4.0” does not have the authority to perform the requested command or operation.” Problem: ASP.NET  v4.0 application has no right to access DB2 database with default application user. Solution: Read more… Login on to server where your application is hosted Create new local user account (myuser, myusrpwd) Add myuser account to DB2ADMNS, […]

VB.NET – OleDbConnection Properties

Insert data using OleDbConnection Use ACE.OLEDB for databse connection (insert data) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim con As New OleDbConnection(“Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Projects\Northwind.accdb;Persist Security Info=False”) Dim CmdStr As String = “insert into sample _ (emp_name,category,city) _ values (‘” & TextBox2.Text & “‘,_ ‘” & TextBox3.Text & “‘,_ ‘” & […]

How to get GetConnectionString()

VB Public Shared Function GetConnectionString() As String Return ConfigurationManager.ConnectionStrings(“ConnectionString”).ToString() ‘ access properties ‘ if access driver is NOT installed on machine – most possible Return “Driver={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=C:\Projects\MyProject\DataSource\ProjectDB.accdb” ‘ if access driver is installed on machine Return “DSN=CrescoOelweinMerger; DBQ=C:\Projects\MyProject\DataSource\ProjectDB.accdb” End Function C# Read more… public static string GetConnectionString() { return ConfigurationManager.ConnectionStrings[“ConnectionString”].ToString(); }