Using a form control (textbox) as an SQL Server parameter

Hi
i am trying to use a form textbox control to filter an SQL query but i do not know how to do this. In fairness, im from an Access background originally and can easily do it in Access lol.
Is it better to connect to the SQL database using code and create an SQL string to get / set data? if so? how can i do that?
or
do i use a table adapter which is my current method but i do not know how to integrate a text control as a query parameter.
for reference-
Query = SQL Server View (Same as access Database Query)
Thanks for any help
Nigel
Nacho is the derivative of Nigel "True fact!"

Hi nmjShaw,
I wrote a sample about how to integrate a text control as query parameter in vb.net.
Dim conn As New System.Data.OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Database2.accdb"
Try
Dim sql As String = "SELECT * FROM tbl_user WHERE username = @username"
Dim dt As New DataTable()
Dim sqlCom As New System.Data.OleDb.OleDbCommand(Sql, conn)
'Open Database Connection
sqlCom.Parameters.AddWithValue("@username", TxtControl.Text)'integrate text control as parameter here
sqlCom.Connection = conn
conn.Open()
Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql, conn)
da.Fill(dt)
' Then you could use the dt.
conn.Close()
Catch ex As Exception
MessageBox.Show("Error:" & ex.Message)
End Try
If you have any other concern regarding this issue, please feel free to let me know.
Best regards,
Youjun Tang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Is sql server using trigger to capture change data in SQL server CDC?

    hi all,
    what is the Architecture of SQL server change data capture(CDC)? is sql server using trigger to capture change data in SQL server CDC? for example Change Data Capture (CDC) in SQL Server 2008 using we can capture change Data records INSERTs, UPDATEs, and
    DELETEs applied to SQL Server tables.so my question is SQL server using triggers to capture change data like INSERT TRIGGER, UPDATE TRIGGER and DELETED TRIGGER using each tables after enabled CDC...?
    Thanks
    Tharindu Dhaneenja 
    Tharindu Dhaneenja http://dhaneenja.blogspot.com

    It is not using triggers. The source is the transaction log.
    Related link:
    Basics of Change Data Capture
    ...The source of change data for change data capture is the SQL Server transaction log. As inserts, updates, and deletes are applied to tracked source tables, entries that describe those
    changes are added to the log. The log serves as input to the change data capture capture process. This reads the log and adds information about changes to the tracked table’s associated change table. Functions are provided to enumerate
    the changes that appear in the change tables over a specified range, returning the information in the form of a filtered result set. The filtered result set is typically used by an application process to update a representation of the source in some external
    environment. ...
    Kalman Toth, SQL Server & Business Intelligence Training; SQL Server 2008 Training

  • Can I use Other database as the repository, Sybase/SQL Server? Urgent!!!

    Hi all,
    Can I use Other database as the repository, Sybase/SQL Server? Urgent!!!
    And Can I use other database store business data and sync with lite?
    Thanks ahead!!!

    Jonathan,
    No, it is not possible to use any other database than Oracle (8.1.7) or later .
    Oracle Lite will only work with Oracle.
    Regards

  • Why can't i use "INNER JOIN" in a query for SQL Server with JDBC??????

    Hi,
    I'm trying to execute some SQL queries and I just don't understand what's wrong.
    I�m using Tomcat and SQL Server in order to do this, but when I�m try to execute a query with a INNER JOIN statements Tomcat raise a SQL exception... at the very first time I thought there was a problem with database connection but I realize that a simple query to a table works pretty well. then I found out some problems with JDBC:ODBC.... so I install JDBC for SQL Server 2000 and test with the same simple query and works..... so, I come to a conclusion.... INNER JOIN or JOIN statements can't be used in JDBC..... please... somebody tell I�m wrong and give me a hand...
    I'm using TOMCAT 4 and JDK 1.4 SQL Server 2000
    Error occurs when executeQuery() is called.... not prepareStatement().... ??????
    Driver DriverRecResult = (Driver)Class.forName(driver).newInstance();
    Connection ConnRecResult = DriverManager.getConnection(DSN,user,password);
    PreparedStatement StatementRecResult = ConnRecResult.prepareStatement(query);
    ResultSet RecResult = StatementRecResult.executeQuery(); <---- Exception raise here
    So much tahnks in advance,

    That's exactly what I think, driver it's raising the exception, but I don't know why.... i test the same query with INNER JOIN directly from SQL Query Analyser and it's works perfectly, my problem ain't SQL, but JSP and JDBC 'cause i'm a newbie about these issues.
    Common sense tell me possible problems lie in SQLServer drivers 'cause i run the same pages on JRUN through jdbc:odbc and do works well, but by now i just depend on Tomcat.....
    I've installed SQL Server drivers for JDBC but i just find it doesn't work fully... could be the version of JDK i've installed? what version do i need?
    ( I'm running Tomcat 4 with JDK 1.4 & SQL Server 2000 W2K )
    thanks for reply.

  • Can we use SSRS in sharepoint 2013 standard and sql server standard edition

    can we use SSRS in sharepoint 2013 standard and sql server standard edition
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    Yes you can. You do lose some features:
    http://msdn.microsoft.com/en-us/library/cc645993.aspx#Reporting
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Creating and Using View Objects on JDev 10g against SQL Server 2005

    I'm currently working on this project on Jdeveloper against a SQL Server 2005 DB (I couldn't talk this people to migrate to Oracle... :-( ), and it's the first time I work with JDev against a database other than 10g.
    I had no problem making the connection, and I can see the DB in Conections->Databases, but when I create an app. module, and create entities and views and add them to the app. module to access them through the Data Controls, these don't work. I can see the view on the Data Controls, and when I drag them to my jspx page it shows the menu that let's me choose whether I want to create a table, or a selection, or a tree, but once I choose one, it does nothing.
    I've search all over the internet and haven't found a solution, so I come to this forum desperate for help, seriously.
    Please get in touch; if anyone knows another solution that doesn't involve not using JDev or SQL Server 2005, please let me know, because I basically need to have a few selectonechoice showing some data from a few tables.
    Thanks for reading this post, and hope to get help.
    Carlos.

    Hi,
    can you run the model in the ADF BC tester ? If this is possible the SQL Server doesn't seem to be the problem. Are you on JDeveloper 10.1.3.3? If not, just get this latest build
    Frank

  • SSIS Package developed in SQL Server 2008 R2 Using BIDS 2008 is not working in SQL Server 2012

    I am working in a Product based company.
    We have given a Pre-requisites to our customers like SQL Server version should be 2008 or later.
    I have developed and deployed my SSIS package in SQL Server 2008 R2 with BIDS 2008.
    I have used "Script Component" in my package.
    We will take only DTSX package file to the customer places and run using SQL Agent Job daily. 
    Who are all(Customer Environments) using SQL 2008 or R2 my package is running fine.
    Who are all(Customer Environments) using SQL 2012, I am facing the below issue 
    The component metadata for “Script Component, clsid {874F7595-FB5F-4OFF-9BAF-FBFF825OE3EF}” could not be upgraded to the newer version of the component. The PerformUpgrade method failed.
    Still the same package is running fine for some of the customers having SQL 2012.
    I am getting the above error only for few customers.
    Can someone please guide me how to proceed on this. Is there any solution to go without upgrading the package to SQL 2012. Because we need to maintain only one package for all customers

    Hi Katherine,
    I am just using the script component only for generating Identity column purpose. I will get the maximum count from the table and using this count value as Input (JurisCount in my below code) for script component and increment the counter for new records.
    Finally I am mapping the Script component output value (JurisKey in my below code) to Key column of the table. That's all I am doing with Script Component.
    Here is my Simple .net code
    /* Microsoft SQL Server Integration Services Script Component
    *  Write scripts using Microsoft Visual C# 2008.
    *  ScriptMain is the entry point class of the script.*/
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
    [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
    public class ScriptMain : UserComponent
        public override void PreExecute()
            base.PreExecute();
              Add your code here for preprocessing or remove if not needed
        public override void PostExecute()
            base.PostExecute();
              Add your code here for postprocessing or remove if not needed
              You can set read/write variables here, for example:
              Variables.MyIntVar = 100
        int counter = 0;
        public override void Input0_ProcessInputRow(Input0Buffer Row)
            if (counter == 0)
                counter = Convert.ToInt32(Row.JurisCount);
            Row.JurisKey = counter;
            counter = counter + 1;
    PAVAN MSBI

  • Encrypting communication between an app that uses an ODBC/DSN (with ADODB) and SQL Server 2008 R2

    I've been doing a lot of reading the last couple of days on how we can encrypt db communication between our product app and a customer's SQL Server db, but cannot make it work as expected. The app uses a ODBC/DSN to connect to the SQL Server db. I use this
    ODBC app to setup the DSN (on a Windows 7 PC):
    C:\Windows\SysWOW64\odbcad32.exe
    The  DSNconnection uses the SQL Server driver 6.01.7601.17514 and has these properties:
    - WinNT authentication.
    - Client Config button: TCP/IP to <server-name>\<instance.-name>
    - Change to default db: <name-of-app-db>
    - Everything else is default setting.
    SQL Server is on the same Windowns 7 PC and has a self-signed cert installed (used IIS to generate it) and has the Force Enryption set to "yes".
    I have a test C# program that uses the ADODB 2.7.0.0 COM-wrapper, made by Visual Studio after adding a reference to the ADO 2.7 library version 6.1.7601.17857. The program creates an ADODB.Connection object that has a simple connection string: "DSN=<san-name>;UID=<user>;PWD=<password>". The
    program then creates an ADODB.Recordset object and reads and displays a field from a table.
    Works fine.
    If I go into SQL Server and set Force Encryption to "no," clear the cert, restart the SQL service, and then re-run the program, it works fine.
    Here's the kick. If I go into the DSN and select "Use strong encryption for data" the Test button on the DSN works—why does it work? The SQL Server is no longer encrypting the connection so an error should occur. If I run the test program, it works
    as well—why? I can look at the connection properties in the test program and see that ADODB has added the ";Encrypt-yes" stuff to the end of the connection string. Yet that option seems to have no effect.
    If I set the SQL instance back to Force Encryption:yes, enable the cert, restart the SQL service, and clear the DSN's "Use strong encryption for data" option, I can still connect to the db with the
    test program—why?
    What am I doing wrong? I need to be able to ensure that the communication between our app product and the SQL instance is encrypted, and that we get an error if the SQL instance does not support encrypted communications. We really don't want the customer
    to have to enable Force Encryption because they have other db's on their SQL Server that do not use encrypted communication, but they want to know that our product's communication channel with the db is encrypted.
    No, I can't change the app product's code at this point in time. I'm stuck with working with what a DSN called from ADODB has to offer.
    Also, how can I be sure that communications are encrypted? I mean, I've tried things like "SELECT * FROM sys.dm_exec_connections" but that doesn't help because I have no idea how to tie the list of sessions shown back to my test program, although
    I guess it's a good thing that some of the sessions listed show encrypt_option as TRUE.
    -glenn-

    Ah yes, very good point. It's easy to miss because you have to delete then recreate the DSN in order to change drivers. So I switched the DSN over to the SQL Native 11 driver.
    Now when I try to connect to the SQL instance as <computer-name>\<instance-name>, and without a cert on the server, I get "the target principal name is incorrect". Perfect; now we're getting somewhere!
    Change my DSN to use <fqdn>\<instance-name> and it works. This tells me that SQL Server has auto-generated a cert and named it <fqdn>. I would have expected the "cert fail" error, not a cert
    name mismatch, because I'm not using Trust Server Cert.
    So I load up my self-signed cert, and that works too.
    I am still confused as to why I'm not seeing the "cert fail" error when I have no cert loaded on the SQL Server. I am not using Force Encryption on the server at all, so wouldn't expect SQL Server to auto-create a cert when an Encrypt=yes request comes in,
    but apparently it does?
    I also ran into a problem with this:
    select c.session_id, c.encrypt_option, s.client_interface_name
    from sys.dm_exec_connections c
    join sys.sysprocesses s
      on c.session_id = s.session_id
    where s.dbid = db_id('MyDatabase')
    There is no s.client_interface_name, probably should be s.hostname. There's also no s.session_id. I thought maybe this should be s.sid, but then no rows ever come back. The c.session_id looks like 51 and 52, but the s.sid looks like a very long binary number,
    so these two fields cannot be joined. I don't know how to convert the sid's properly so that the join would work. Ah wait, I just found the s.spid column; the join works when that column is used (I assume that's correct anyhow).
    If I add a Thread.Sleep(30 seconds) to my C# program just before the connection is closed, this query shows me the session for the correct hostname has encrypt_option=TRUE.
    And I have to keep my fingers crossed that all the app I/O will still work properly after
    changing the driver. Probably a safe bet though.
    Think I'm ready to throw in the towel on getting the "cert fail/no SSL" error to appear.
    It does look like I am able to sufficiently show that the connection is encrypted when Encrypt=yes is used with the newer driver.
    Thank for all the help!
    -glenn-

  • Using BizTalk Enterprise Edition 2009/2013 with SQL Server Standard Edition vs Enterprise Edition

    Hi All,
     I would like to know what are the Drawbacks of using BizTalk Server Enterprise Edition 2009/2013 with SQL Server Standard Edition vs Enterprise Edition.
    We are currently using Enterprise Edition.
    1) Are there any adverse performance constraints? Microsoft mentions to use SQL Server Enterprise Edition for "Optimal Performance" but does not expand on the topic. 
    2) Any features missing?
    2) Is there a supported way to downgrade SQL Enterprise to Standard for an exisiting BTS Environment?
    Thanks!

    1) SQL Standard is limited to 4 CPU's and 64GB of memory while Enterprise is 8 CPU and 2TB or memory.
    2) The only BizTalk feature dependency on a SQL Enterprise feature is BAM Real-Time Aggrigations which requires Analysis Services RTA.
    3) Yes, but it's not a SQL downgrade really, you would move the BizTalk databases:
    http://msdn.microsoft.com/en-us/library/aa559835.aspx

  • Using forms6i and reading data from MS SQL server 7

    Hi!
    I have been given a new task to connect to Microsoft SQL SERVER 7 with Oracle 6/6i development with ODBC and extract specific data.
    I am realy stuck with this I hope some one will help me with this as soon as possible.
    thanka

    I did a similar thing with developer 2000 (Form 4.5) and SQL server6.5.
    There are lots of things involved and there will be issues that need to be resolved in you application but you can take one thing at a time and you should be able to do it.
    -First make sure that your SQL server is up and running.
    -Then make a client machine that connects to SQL server.
    -On the client install your Form6 or 6i.
    -Install ODBC manager on your Client Machine.
    -Get the Oracle ODBC driver for SQL server.
    -There is a document available with developer 2000 for open data source. It should be with your Form6/6i documentation. It has got a section for connection with SQL server.
    Start with this and where ever you get stuck ask away question on the forum.
    Hope this help

  • Using Discoverer 4i to view data on SQL Server

    Hello,
    We have Discoverer 4i set up to work with Oracle 9i. Now our Discoverer users want to use Discoverer to view data that is in SQL Severer. We don't want to rebuild data in SQL Server into 9i. What can we set up so 4i can view and maybe update data that is in SQL Severer. Thank you.

    I can't tell exactly what the problem is, but why don't you try a different approach.  See a couple of the tutorials from the link below, and try it again.
    https://www.youtube.com/watch?v=sbkQEBrhl5M
    https://www.youtube.com/watch?v=Grb9vWmtZe0
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Can I use attunity CDC to propagate changes from sql server to a sybase database

    can i use attunity cdc components in sql server to propagate changes to a sybase destination. I did some experimenting with cdc in ssis 2012 and got it working to send changes to sybase, but I need to do this for approx 5000 tables. so looking for a product
    that can do this for me.
    ny help welcome
    thanks
    Geert Vanhove DCOD ------ http://geertvanhove.wordpress.com/ ----------- Please click the Mark as Answer or Vote As Helpful if a post solves your problem or is helpful!

    Hello,
    It seems that you try to with captures SQL Server data changes and move to Sybase database with Attunity CDC. Since it is a thrid party tool, I suggestion that you post the question in the
    Attunity site for support.
    Reference:Attunity CDC
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • MAP Toolkit - How to use this MAP tool kit for all SQL Server inventory in new work enviornment

    Hi Every one
     Just joined to new job and planning to do Inventory for whole environment so I can get list of all SQL Server installed . I downloaded MAP tool kit just now. So looking for step by step information to use this for SQL Inventory. If anyone have documentation
    or screen shot and can share would be great.
    Also like to run It will be good to run this tool anytime or should run in night time when is less activity? 
    Hoe long generally takes for medium size environment where server count is about 30 ( Dev/Staging/Prod)
    Also any scripts that will give detailed information would be great too..
    Thank you 
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Hi Logicinisde,
    According to your description, since the issue regards Microsoft Assessment and Planning Solution Accelerator. I suggestion you post the question in the Solution Accelerators forums at
    http://social.technet.microsoft.com/Forums/en-US/map/threads/ . It is appropriate and more experts will assist you.
    The Microsoft Assessment and Planning (MAP) Toolkit is an agentless inventory, assessment, and reporting tool that can securely assess IT environments for various platform migrations. You can use MAP as part of a comprehensive process for planning and migrating
    legacy database to SQL Server instances.
    There is more information about how to use MAP Tool–Microsoft Assessment and Planning toolkit, you can review the following articles.
    http://blogs.technet.com/b/meamcs/archive/2012/09/24/how-to-use-map-tool-microsoft-assessment-and-planning-toolkit.aspx
    Microsoft Assessment and Planning Toolkit - Technical FAQ:
    http://ochoco.blogspot.in/2009/02/microsoft-assessment-and-planning.html
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Cannot use XML Forms Builder - HTTP response: 500 - Internal Server Error

    Hi,
    I am trying to use XML Forms Builder, have added the corresponding role to my profile and when I create a new application or do anything I get the following error popup:
    HTTP response: 500 - Internal Server Error.
    What should I do ??
    Thank you for your help.
    Thibault Schalck

    Hi,
    Check the below link for environment checking of XML Form Builder
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9e/9c8f411467ac5fe10000000a1550b0/frameset.htm
    Raghu

  • Point/Migrate batch jobs from Sybase(auto scheduled through Control-M application) to SQL Server 2005

    Hi,
    I am currently working in project where we need to migrate/point batch jobs to SQL server 2005. At this moment they are pointing to Sybase. Batch jobs are in .bat and .exe format. These jobs read in an external file, does some reformatting,
    and then loads it into 2 sybase tables. These jobs are auto scheduled through Control-M application.
    Any idea please ?
    Thanks,
    Chirag Patel

    Change your post to type 'Question' Chirag
    You would need to at least change the connection strings, and how you access SQL Server, but typically code changes are necessary.
    You unfortunately don't provide enough details. But it is not as trivial to just 'point' a bunch of jobs to a new target.
    Arthur My Blog

Maybe you are looking for

  • How can I reduce the amount of storage a shared photo stream is taking on one of my devices

    I have over 8000 photos on the Cloud in various shared photostreams.  They all appear on all my devices which is great.  The devices show the photos using about 1GB of memory unless I plug into iTunes when it reveals they are in fact using circa 15GB

  • Attachments still not opening even after new September Update??

    I hope someone might be able to shed some light on this. After the new update I sent myself some word, excel, pdf attachments thinking to try the tilt/landscape feature in viewing attachments, but nothing. The attachment still shows up as a bar with

  • Only prints black and white

    my sisters brand new Envy 5660 printer only prints in black and white. i've been all over the net and my iMac trying to figure out what the problem, but to no avail. i've looked for the paper type/ quality etc settings that were soloutions to other p

  • Set custom font size for one column

    hey guys! I am trying to decrease the font-size for one column based on an lov and used style="font-size:8pt"It does not work though! Do you have a hint? brgds, seb

  • Possibly crashed.... Now flashing folder symbol with question mark.

    Hi I think my iMac crashed tonight. It kept freezing, and i couldnt force quit anything. I restarted, and then none of my programs would open, and i couldnt click on anything. I held in my power button, shut it off and kept it held in. Then a blank w