Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8912991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:21:05+00:00 2026-06-15T04:21:05+00:00

Recently I’ve been assigned to a project where we have to migrate an old

  • 0

Recently I’ve been assigned to a project where we have to migrate an old VB3 process to C#, this process takes data from an Access 97 file and Insert it into SQL Server, the problem is that some ‘genius’ call a field “Ta/Tj” and the ‘/’ is breaking our code, we tried different ways but fail. We can’t change the field name right now because we don’t know exactly how many programs use that table.

Here is my code

    OleDbConnection connectionEpsOle = new OleDbConnection();
        SqlConnection connectionEpsSql = (SqlConnection)GetConexion.GetConnectionIus();
        DbDataAdapter dataAdapter;
        long nIus;
        long nIdGenealogia;
        string sRubroStr;

        DataSet dataSet = new DataSet();
        DataRow dr;

        string sqlCadena = "SELECT * FROM Tesis WHERE ius =0";

        dataAdapter = new SqlDataAdapter();
        dataAdapter.SelectCommand = new SqlCommand(sqlCadena, connectionEpsSql);

        dataAdapter.Fill(dataSet, "Tesis");

        sRubroStr = tesisDto.RUBRO;
        sRubroStr = MiscFunct.QuitaCarCad(sRubroStr);
        sRubroStr = MiscFunct.ConvMay(sRubroStr);
        sRubroStr = MiscFunct.QuitaDblEspacio(sRubroStr);
        sRubroStr = sRubroStr.Trim();

        if (sRubroStr.Length > 250)
        {
            sRubroStr = sRubroStr.Substring(0, 250);
        }

        dr = dataSet.Tables["Tesis"].NewRow();

        dr["IUS"] = tesisDto.IUS;
        dr["Parte"] = 200;
        dr["Consec"] = 0;
        dr["Rubro"] = tesisDto.RUBRO;
        dr["Texto"] = tesisDto.TEXTO;
        dr["Prec"] = tesisDto.PRECEDENTES;
        dr["Epoca"] = tesisDto.Epoca;
        dr["Sala"] = tesisDto.Sala;
        dr["Fuente"] = tesisDto.Fuente;
        dr["Volumen"] = tesisDto.Volumen;
        dr["Tesis"] = tesisDto.Tesis;
        dr["Pagina"] = tesisDto.Pagina;
        dr["TA/TJ"] = tesisDto.TATJ;
        dr["Materia1"] = tesisDto.Materia1;
        dr["Materia2"] = tesisDto.Materia2;
        dr["Materia3"] = tesisDto.Materia3;
        dr["IdGenealogia"] = tesisDto.idGenealogia;
        dr["ConsecIndx"] = 0;
        dr["IdTCC"] = 0;
        dr["InfAnexos"] = 0; 
        dr["LocAbr"] = " ";
        dr["NumLetra"] = 0;
        dr["ConsecLetra"] = 0;
        dr["Instancia"] = 0;
        dr["ConsecInst"] = 0;
        dr["LocExp"] = " ";
        dr["RIndx"] = "RRR";
        dr["TIndx"] = "TTT";
        dr["PIndx"] = "PPP";
        dr["LIndx"] = "LLL";
        dr["Certificada"] = 0;
        dr["IdSubVolumen"] = 0;

        dataSet.Tables["Tesis"].Rows.Add(dr);

        //dataAdapter.UpdateCommand = connectionEpsSQL.CreateCommand();
        dataAdapter.InsertCommand = connectionEpsSql.CreateCommand();
        dataAdapter.InsertCommand.CommandText = "INSERT INTO Tesis(IUS,Parte,Consec,Rubro,Texto,Prec," +
                                                "Epoca,Sala,Fuente,Volumen,Tesis,Pagina,[TA/TJ],Materia1,Materia2,Materia3," +
                                                "IdGenealogia,ConsecIndx,IdTCC,InfAnexos,LocAbr,NumLetra,ConsecLetra,Instancia," +
                                                "ConsecInst,LocExp,RIndx,TIndx,PIndx,LIndx,Certificada,IdSubVolumen)" +
                                                " VALUES(@IUS,@Parte,@Consec,@Rubro,@Texto,@Prec," +
                                                "@Epoca,@Sala,@Fuente,@Volumen,@Tesis,@Pagina,@[TA/TJ],@Materia1,@Materia2,@Materia3," +
                                                "@IdGenealogia,@ConsecIndx,@IdTCC,@InfAnexos,@LocAbr,@NumLetra,@ConsecLetra," +
                                                "@Instancia,@                                                ConsecInst,@LocExp,@RIndx,@TIndx,@PIndx," +
                                                "@LIndx,@Certificada,@IdSubVolumen)";

        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@IUS", SqlDbType.BigInt, 0, "IUS");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Parte", SqlDbType.Int, 0, "Parte");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Consec", SqlDbType.Int, 0, "Consec");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Rubro", SqlDbType.Text, 0, "Rubro");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Texto", SqlDbType.Text, 0, "Texto");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Prec", SqlDbType.Text, 0, "Prec");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Epoca", SqlDbType.Int, 0, "Epoca");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Sala", SqlDbType.Int, 0, "Sala");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Fuente", SqlDbType.Int, 0, "Fuente");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Volumen", SqlDbType.Int, 0, "Volumen");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Tesis", SqlDbType.VarChar, 0, "Tesis");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Pagina", SqlDbType.VarChar, 0, "Pagina");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@[TA/TJ]", SqlDbType.Int, 0, "TA/TJ");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Materia1", SqlDbType.Int, 0, "Materia1");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Materia2", SqlDbType.Int, 0, "Materia2");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Materia3", SqlDbType.Int, 0, "Materia3");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@IdGenealogia", SqlDbType.BigInt, 0, "IdGenealogia");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@ConsecIndx", SqlDbType.Int, 0, "ConsecIndx");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@idTCC", SqlDbType.SmallInt, 0, "idTCC");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@InfAnexos", SqlDbType.TinyInt, 0, "InfAnexos");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@LocAbr", SqlDbType.NVarChar, 0, "LocAbr");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@NumLetra", SqlDbType.TinyInt, 0, "NumLetra");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@ConsecLetra", SqlDbType.Int, 0, "ConsecLetra");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Instancia", SqlDbType.SmallInt, 0, "Instancia");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@ConsecInst", SqlDbType.Int, 0, "ConsecInst");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@LocExp", SqlDbType.NText, 0, "LocExp");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@RIndx", SqlDbType.NText, 0, "RIndx");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@TIndx", SqlDbType.NText, 0, "TIndx");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@PIndx", SqlDbType.NText, 0, "PIndx");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@LIndx", SqlDbType.NText, 0, "LIndx");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@Certificada", SqlDbType.TinyInt, 0, "Certificada");
        ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@IdSubVolumen", SqlDbType.Int, 0, "IdSubVolumen");


        dataAdapter.Update(dataSet, "Tesis");

        dataSet.Dispose();
        dataAdapter.Dispose();
        connectionEpsOle.Close();

The Ta/Tj column holds tinyint values

Here is the SqlException message

Line 1: Incorrect syntax near ‘int’. Must declare the variable ‘@’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:21:07+00:00Added an answer on June 15, 2026 at 4:21 am

    You can leave the columns and variables in their unfortunate state. Just change the parameter name you are passing to something OLE compatible:

    In VALUES list: use @TA_TJ instead of @[TA/TJ]

    In list of params change to:

    ((SqlDataAdapter)dataAdapter).InsertCommand.Parameters.Add("@TA_TJ", SqlDbType.Int, 0, "TA/TJ");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently, we have changed from MySQL to PostgreSQL. Most of the queries have been
recently, while working on a db2 -> oracle migration project, we came across this
Recently, we discovered odd behavior in some old code. This code has worked for
Recently I've been doing quite the project mostly working with the DateTime class. Now,..
Recently we started working with Database project in Visual Studio 2010. I have added
Recently I have been dealing with windows LogonUser API. The LogonUser api returns different
Recently I've been doing things like this: import Tkinter class C(object): def __init__(self): self.root
Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my
Recently I noticed (after others have extended the project) that the compile time significantly
Recently I've started following a pre-existing project based on ASP.NET 3.5. Now, I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.