Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all 1350 articles
Browse latest View live

Need help to check two tables for users name??

$
0
0

Hi,

i need help to build a query. There is two tables one is Auditor and another one is Users. In both tables i have first_name and last_name columns. All i want to check existing value during the save. if same first_name and last_name exist any of the table then return count >0.

Thanks in advanced!


The 'MSIDXS' provider is not registered on the local machine.

$
0
0

I am using Windows 10 Professional and getting this message 

The 'MSIDXS' provider is not registered on the local machine.

string connectionString =
string.Format("Provider= \"MSIDXS\";Data Source=\"Downloads\";");
OleDbConnection connection = new OleDbConnection(connectionString);

connection.Open();

How to do expand/collapse table in mvc 5

$
0
0

Hi,

I am new to MVC. I need to do a task, where I need to implement Praent-Child table in MVC. Like fetch
data from DB and display Companies(Company Name, Location, TypeOFBusiness) in a table, if we click on CompanyID,
we need to display Employees of that Company as a Child Table(Like EmployeeName,Designation, Location). A
Any references or small POC would be highly appreciated. Thanks.

How do you find a P-value in Microsoft Excel?

$
0
0

Hey there,

Last night when i was doing my official website i got problem that's why i joined this forum and my question is How do you find a P-value in Microsoft Excel?

--

Regards

Rose Bronwen,

Website: Hosting Reviews

Oracle version error -C#.NET

$
0
0

In  VS 2010 ,Showing version  error while submitting in local host, when publishing to server it is working .How to solve this

ASPX and MYSQL

$
0
0

I did my timeIn and timeout in dropdown from and I get set in the cs page. But I am trying to retrieve it from MySQL now , but i got no idea how to do it ! can someone please help me? I just started learning Visual Studios not long ago. The code is below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Diagnostics;

namespace Meeting_Room_booking_System
{
    public partial class CancelRecur : System.Web.UI.Page
    {
        public String GetSelectedTimeIn
        {
            get
            {
                return this.DropDownList1.SelectedValue + ":" + this.DropDownList2.SelectedValue;

            }
            set
            {
                value = this.DropDownList1.SelectedValue + ":" + this.DropDownList2.SelectedValue ;
            }

        }
        public String GetSelectedTimeOut
        {
            get
            {
                return this.DropDownList4.SelectedValue + ":" + this.DropDownList5.SelectedValue;
            }
            set
            {
                value = this.DropDownList4.SelectedValue + ":" + this.DropDownList5.SelectedValue;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
            //   // string sql = @"Select * from Meeting WHERE date ={0}";//

            //}
            if (!Page.IsPostBack)
            {

                ReqDate.Enabled = false;
                ReqRoom.Enabled = false;
                for (int index = 00; index <= 23; index++)
                {
                    DropDownList1.Items.Add(index.ToString("00"));
                    DropDownList4.Items.Add(index.ToString("00"));
                }
                for (int index = 00; index <= 60; index++)
                {
                    DropDownList2.Items.Add(index.ToString("00"));
                    DropDownList5.Items.Add(index.ToString("00"));
                }
            }


        }


        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            string sql = @"DELETE FROM Meeting WHERE meeting_id = {0}";
            int result = DBUtl.ExecSQL(sql, TxtMeetingID.Text);
            if (result == 1)
            {
                LtlMsg.Text = String.Format("Meeting ID {0} has been deleted.", TxtMeetingID.Text);
                TxtMeetingID.Text = "";
                TxtDate.Text = "";
                DrpPax.SelectedValue = "0";
                DrpRoom.SelectedValue = "";
            }
            else
            {
                LtlMsg.Text = "Error " + DBUtl.DB_Message;
            }
        }

        protected void BtnEdit_Click(object sender, EventArgs e)
        {
            string sql = @"UPDATE Meeting SET date = {1},
                                            room_name = '{2},
                                            attendees_pax = {3},
                                            start_time = '{4}',
                                            end_time = '{5}',
                                            where meeting_id = {0}";
            int rowsAffected = DBUtl.ExecSQL(sql, Request["id"],
                                                    TxtDate.Text,
                                                    DrpRoom.Text,
                                                    DrpPax.Text,
                                                    GetSelectedTimeIn,
                                                    GetSelectedTimeOut);
            if (rowsAffected == 1)
            {
                Response.Redirect("CurrentBooking.aspx");
            }

        }

        protected void BtnRecur_Click(object sender, EventArgs e)
        {
            Response.Redirect("RecurBooking.aspx");
        }


        protected void BtnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("CurrentBooking.aspx");
        }

        protected void BtnFind_Click(object sender, EventArgs e)
        {
            int meeting_id = 0;
            LtlMsg.Text = "";
            bool result = Int32.TryParse(TxtMeetingID.Text, out meeting_id);

            if (result)
            {
                Get_Booking();
            }
            else
            {
                LtlMsg.Text = "ID must be an integer";
            }
        }


        protected void Get_Booking()
        {
            // TODO P13 Task 1: Add code to fetch the movie based on the value of TxtId.
            string sql = @"SELECT * FROM Meeting Where  meeting_id = {0} ";
            DataTable dt = DBUtl.GetTable(sql, TxtMeetingID.Text);
            if (dt.Rows.Count == 1)
            {
                //populate the form = retrieve value from DataTable
                Debug.Write(dt.Rows.Count);
                TxtDate.Text = Convert.ToDateTime(dt.Rows[0]["date"]).ToString("dd-MM-yyyy");
                //DrpRoom.SelectedValue = dt.Rows[0]["room_name"].ToString();
                DrpPax.SelectedValue = dt.Rows[0]["attendees_pax"].ToString();
                GetSelectedTimeIn.ToString();
                GetSelectedTimeOut.ToString();

            }
            else
            {
                LtlMsg.Text = "Meeting ID not found – please try again.";
            }
        }

    }
}

MYSQL

$
0
0

Can someone help me with my code? I tried to solve it for hours but just couldnt get it right!

protected void BtnEdit_Click(object sender, EventArgs e)
        {
            string sql = @"UPDATE Meeting SET date = {1},
                                            room_id = {2}
                                            attendees_pax = '{3}',
                                            start_time = '{4}',
                                            end_time = '{5}',
                                            where meeting_id = {0}";

            int rowsAffected = DBUtl.ExecSQL(sql,
                                                    TxtDate.Text,
                                                    DrpRoom.SelectedValue,
                                                    DrpPax.SelectedValue,
                                                    GetSelectedTimeIn,
                                                    GetSelectedTimeOut);


            if (rowsAffected == 1)
            {
                Response.Redirect("CurrentBooking.aspx");
            }
            else
            {
                LtlMsg.Text = "Error";
            }
        }

I kept getting 2 errors;

1. 

An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code. Additional information: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

2. An exception of type 'System.NullReferenceException' occurred in  System.dll but was not handled in user code Additional information: Object reference not set to an instance of an object.

Unable to connect to any of the specified MySQL hosts

$
0
0

I hosted a web api on a windows server that is to connect to mysql database server hosted in another server. The windows server has been give perimission to access the database and i was also able to connect the remote database using a workbench on the windows server but if my c# api application trys to access the remote database i get the below error...

"Unable to connect to any of the specified MySQL hosts.
stacktrace at MySql.Data.MySqlClient.NativeDriver.Open()\r\n at MySql.Data.MySqlClient.Driver.Open()\r\n
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)\r\n
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()\r\n at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()\r\n
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()\r\n
at MySql.Data.MySqlClient.MySqlPool.GetConnection()\r\n at MySql.Data.MySqlClient.MySqlConnection.Open()\r\n
at SMSMobileApp.Controllers.SecondaryResultController.FetchCollegeResult(String sessionname, Int32 termid, String regno) in C:\\Users\\OLUWASEUN\\Documents\\Visual Studio 2017\\Projects\\SMSMobileApp\\SMSMobileApp\\Controllers\\SecondaryResultController.cs:line 79"

BELOW IS CONNECTION STRING

<add name="smsresult" connectionString="Data Source=166.63.122.xx;port=3306;Initial Catalog=databasename;User Id=mydatabaseID;password=mypassword" />

Please i need help ...........................


How to pass two or more Parameter inside foreach loop

$
0
0

Hi Everyone,

In ASP.NET c# web service I would like to pass two or more parameters I don't know how to achieve this, someone please help me out to resolve this.

I'm using Oracle DB and the stored procedure and here is my sample code

OracleParameter childretval = new OracleParameter("P_RECORDSET", OracleDbType.RefCursor);
childretval.Direction = ParameterDirection.ReturnValue;

var childParameters = new OracleParameter[2];
childParameters[0] = childretval;
childParameters[3] = new OracleParameter {
Direction=ParameterDirection.Input,
Value=dr["IDNUMBER"],
OracleDbType= OracleDbType.Varchar2,
Size=100,
ParameterName = "P_ACCOUNT_ID",
//startdate="P_START_DATE"

//Enddate="P_END_DATE"

};

I would like to pass these 3 parameters.(ParameterName,start date,End date)

Thanks in advance

Write a query with count function for same project number and any date in the current year??

$
0
0

Hi,

i am trying to check a table which has two columns(one is project_num and another one is INSPECT_DATE ).  write a query to prevent insert the values if i have same project number and any INSPECT_DATE in the current year into oracle table. all i want to use count function, so that query can count for the same project and any date exist for the current year. from the below query what i need to do to get the column existing date from oracle database.

query = " select count(project_num) count from PHY_INSP_SCHEDULE where project_num='" & Ddl_proj.SelectedItem.Value & _

"' and INSPECT_DATE = dt.ToString(""yyyy-MM-dd"") "
If SavedAlready(query) > 0 Then
alert = "<script language='javascript'>" & _
"alert ('This Project is already saved. you cannot make different schedule within year with same project')"
End If

Unable to connect to any of the specified MySQL hosts

$
0
0
<div class="comment-right-col comment-body">

I hosted a web api on a windows server that is to connect to mysql database server hosted in another server. The windows server has been give perimission to access the database and i was also able to connect the remote database using a workbench on the windows server but if my c# api application trys to access the remote database i get the below error...

<div>

"Unable to connect to any of the specified MySQL hosts. 
stacktrace at MySql.Data.MySqlClient.NativeDriver.Open()\r\n at MySql.Data.MySqlClient.Driver.Open()\r\n 
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)\r\n 
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()\r\n at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()\r\n 
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()\r\n 
at MySql.Data.MySqlClient.MySqlPool.GetConnection()\r\n at MySql.Data.MySqlClient.MySqlConnection.Open()\r\n 
at SMSMobileApp.Controllers.SecondaryResultController.FetchCollegeResult(String sessionname, Int32 termid, String regno) in C:\\Users\\OLUWASEUN\\Documents\\Visual Studio 2017\\Projects\\SMSMobileApp\\SMSMobileApp\\Controllers\\SecondaryResultController.cs:line 79"

BELOW IS CONNECTION STRING

<add name="smsresult" connectionString="Data Source=166.63.122.xx;port=3306;Initial Catalog=databasename;User Id=mydatabaseID;password=mypassword" />

Please i need help ...........................

</div> </div>

C# performance issues while reading data from Oracle database

$
0
0

I have a stored procedure in Oracle database which have 1 clob type input parameter and 1 clob type output parameter.

I am passing xml string(have 20 nodes) to stored procedure. This SP iterates through each node value and send backs the result as xml string(clob) in output parameter.

The problem is when i  ran the SP from DB end it gives the results within a minute,but the same taking 5-10 min from C# end

What are the possible causes for this?

Could not load file or assembly 'Oracle.DataAccess, Version=4.122.1.0,

$
0
0

My code works well on my local machine but I move to a new WIndows 2012 server I get the following error"

Could not load file or assembly 'Oracle.DataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

I can see that I am referencing an assembly in the GAC on my local.  It is in Windows\assembly\Oracle.DataAccess  I don't see that on the server. How I can I get that loaded?

ORA-00604 & ORA-08177 with entity framework

$
0
0

hello all

i'm beginner in asp.net mvc and entity framework. and i have started following this example in github : https://github.com/abdelkafiahmed/BankManagementSystem

i creatd a new project MVC5 in visual studio 2012 ultimate, all model class (Banque, Client,...etc), and entity framework context class BankDbContext.

i have oracle database 12c version

Since there is not a connection string in web.config on this example, i decided to use entity framework for accessing to oracle database. i downloaded by nuget and installed the oracle.ManagedDataAccess.EntityFramework, oracle.ManagedDataAccess and EntityFramework v6 packages and t alrered the connection string given by thes packages to

<oracle.manageddataaccess.client><version number="*"><dataSources><dataSource alias="ORCL" descriptor="(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST = localhost)(PORT =1521))(CONNECT_DATA =(SERVICE_NAME = orcl)))"/></dataSources></version></oracle.manageddataaccess.client><connectionStrings><add name="BankDbContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=bcdratest;Password=bcdratest;Data Source=ORCL"/></connectionStrings>

after i have created the Initializer class:

namespace BankAccountsManagementSystem.DataAccessLayer{publicclassInitializer:DropCreateDatabaseAlways<BankDbContext>{protectedoverridevoidSeed(BankDbContext context){


            using(var ctx =newBankDbContext()){var  banque =newBanque{Nom="ENIT Bank",ArgentDepose=0.0m,Capital=0.0m,NbreClients=0,NbreComptes=0,NbreCredits=0,SommeCredits=0};

                ctx.Banques.Add(banque);
                ctx.SaveChanges();}}}}

i have started by creating a BanquesController and Banques/Index view when i executed the application, the database is created in first time. after, i created PersonneMoralesController by scaffolding and altered the index Action by the code on this example

here

but when executing the application i get an exception:

ORA-00604: error occurred at recursive SQL level string1

ORA-08177: can't serialize access for this transaction

 and database is not recreated.

i thought that i have got these errors because of the codes in initializer and banque Controller Index Action, two transactions in same Banques table, so i excluded this Initializer Class File.

but even this, the problem persists when the exectioning of application

why and how to fix this?

soon

Table List Not showing in entity Data model wizard for mysql

$
0
0

I am creating a MVC applciation with MySQL as backend. I am planning to use Entity Framework to work this database. I already have database so need to generate model from database

Environment:

MySQL Server 5.7.21

MySQL for Visual Studio 1.27

Connector/NET 6.10.5

Visual Studio 2015

To Reproduce Issue:

Step 1: Add new item 'Ado.net Entity Data Model'

Step 2: Selected 'EF Designer from database' and click 'Next'

Step 3: Clicked 'New Connection'. Give database details and click Next

After this step, dialogue simply closed without showing Table List


ASP.NET C# connect to Oracle database to update data failture

$
0
0

My project is ASP.NET WebForm with C#. I want to update Oracle data. So I write the C# code as below:

But the cmdQry2.ExecuteNonQuery() return zero. There no data will be update. Does somebody know the SQL or C# has any problem?

DateTime dateTime = DateTime.Now;
string strDateTime = string.Format("{0:000}{1:00}{2:00}{3:00}{4:00}", dateTime.Year - 1911, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute);
string SQL2 = "update \"UserProfile1\" set \"chLogInDT\" = :strDateTime, \"chLogOutDT\" = :strDateTime2, \"chUserSector\" = '電子書',\"chLogInStat\" = :aIP where RTrim(\"chUserID\") = :chUserID ";

Conn.Open();
using (var cmdQry2 = Conn.CreateCommand())
{
    string ip = CommonUse.GetIPAddress();
    cmdQry2.CommandText = SQL2;
    cmdQry2.CommandType = CommandType.Text;
    cmdQry2.Parameters.Add("chUserID", this.txtAccount.Text.Trim());
    cmdQry2.Parameters.Add("strDateTime", strDateTime);
    cmdQry2.Parameters.Add("strDateTime2", strDateTime);
    cmdQry2.Parameters.Add("aIP", ip);

    try
    {
        int n = cmdQry2.ExecuteNonQuery();
        Conn.Close();
    }
    catch (Exception ex)
    {
        Debug.WriteLine(ex.Message);
    }
}

Unable to connect DB2 Data base Error "Unable to load DLL 'db2app.dll'initialization routine failed".

$
0
0

Hi,

I have two ASP.net application hosted on Server, Both applications are connecting to DB2 Database. While connecting Application 1  works without any issue, where as Application 2 is throwing an error while establishing connection with DB2 As "Unable to load DLL 'db2app.dll'initialization routine failed". Not sure why this is happening.

I got this same issue on windows server 2012 and it get solved after providing Access to everyone to IBM folder, but the same thing is not working in Windows server 2016. If I build the code and deploy the same to server then it starts working for some time and after about an hour it starts throwing an error mentioned above

How can optimize already existing index organized table?

$
0
0


Dear all,
I have IOT having 7 million records in oracle database, eventually iot use for fast access primary key but in my case, when i select primary key column it takes 5-4 seconds for select single column. My query is:&lt;br&gt;


Select Emp_Refno from Emp_master where Rownum =1 order by Emp_Refno asc;

I have also used Sql Tunning Advisor for optimize it and also get index suggest ion from SQL Tunning Advisor and also applied it, But in explain plan not seen this index and it takes same time after it.<br>

Problem of sql excel odbc query lauching

$
0
0

Hello,

I've got an error's message following the launching of query. The error's message is :

Détails de l'exception: System.Data.Odbc.OdbcException: ERROR [07002] [Microsoft][ODBC Excel Driver] Too few parameters. Expected 3.

The code is :

protected void ValiderRegion(object sender, EventArgs e)
{
string StringDDL_Region_Selected = DDL_Region.SelectedValue;
if (StringDDL_Region_Selected != null)
{
SqlDataSource3.SelectParameters.Clear();
SqlDataSource3.SelectCommand = "SELECT T_JP_Localisation_NumDptEtDpt FROM [t_jp_localisation$] WHERE T_JP_Localisation_Region = ?RegionJ group by T_JP_Localisation_NumDptEtDpt";
SqlDataSource3.SelectParameters.Add("?RegionJ", DDL_Region.SelectedValue);
DDL_Departement.DataSourceID = "SqlDataSource3";
DDL_Departement.DataValueField = "T_JP_Localisation_NumDptEtDpt";
DDL_Departement.Visible = true;
Bt_Departement.Visible = true;
SqlDataSource3.Dispose();
}

Thanks for your help !

Problem of sql query's execution

$
0
0

Hello,

I've a problem of query's execution. This query is operational with mysql driver and since I used odbc excel driver, this query is not operational.

The code is :

if ((string)Session["TitreJ"] != "")
{
DataSourceSelectArguments args0 = new DataSourceSelectArguments();
SqlDataSource4.SelectParameters.Clear();
SqlDataSource4.SelectCommand = "SELECT COUNT(*) FROM [t_jp_annonce$] WHERE MATCH (T_JP_Annonce_Titre) AGAINST (? IN BOOLEAN MODE) OR idT_JP_Annonce_NumCle= ? AND STR_TO_DATE(T_JP_Annonce_fk_Cmde_DateFerm, '%Y-%c-%d %H:%i:%S') > now() AND T_JP_Annonce_Valide='VALIDE'";
SqlDataSource4.SelectParameters.Add("@TitreA", (string)Session["TitreJ"]);

DataView DtView1 = (DataView)SqlDataSource4.Select(args0);
DataTable DtTable1 = DtView1.ToTable();
SqlDataSource4.Dispose();
return Convert.ToInt32(DtTable1.Rows[0][0].ToString());
}

The error's message :

Exception Details: System.Data.Odbc.OdbcException: ERROR [07002] [Microsoft][ODBC Excel Driver]COUNT field incorrect.

[OdbcException (0x80131937): ERROR [07002] [Microsoft][ODBC Excel Driver]COUNT field incorrect ]

Well well, thanks for your solution !

Rednuts72

Viewing all 1350 articles
Browse latest View live


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