Hoe To Input Apostrophy (') In A Database Field From Asp

Aug 16, 2000

My name is Syed Kamran Ahmed and i'm an ASP
Programmer. I've got a problem with entering values in
database from ASP page, if i use apostropy in a text
box and then passes values to Sql server store
Procedures then it will give following error:
Error Type:
Microsoft OLE DB Provider for SQL Server
(0x80040E14)
Line 1: Incorrect syntax near 's'.
my calling store procedure syntax is:
rsinsert_products.Open "exec sp_insert_products
'"&vPdescription&"',dbc,
adOpenDynamic ,adLockOptimistic .
Where vPdescription contains kamran's home.
Please tell me how i'm gonna put "'" in database from
above method.
Thanx.
Kamran Ahmed

View 1 Replies


ADVERTISEMENT

Parameters Input Field Size

Jul 2, 2007

Hi,



is it possible to change the appearence of input fields for parameters on the report server? My parameter is Multi-value with quite large amount of available values. On report server, user can (without scrolling) see only the first value. Parameter values are quite long, so user has to move alternally with both vertical and horizontal scrollbars to find the right value.



Thanks

Janca

View 1 Replies View Related

Ntext Field Limiting Input To 64,999 Characters

May 24, 2002

I am having an interesting error. I have a bunch of data that I am updating to a field in my sql server 7.0 database. It updates the data, however only puts the first 64,999 characters into the field. The datatype is ntext. From what I understand, ntext datatype can hold much more than 65,000 characters. Am I right in this? The data I'm putting into the field is html tags/text. I've tried several different data sets. I'm updating the data using Coldfusion/SQL commands.

Here is my SQL syntax:

UPDATE htmltest
SET html_offline = '#form.html#'
WHERE htmlid = #form.htmlid#

View 1 Replies View Related

Prompt For User Input In Criteria Field Of View

Apr 12, 2006

In Access, I use [Enter Date] in the Criteria field of the Query. I tried the same thing in SQL Server in the Criteria field of the View and it does not recognize this. Is there a comparable command in SQL to get user input into the Criteria field of a view?

View 4 Replies View Related

Problem With Text Field: Text Input Too Long, Weird Characters

May 15, 2006

Hi,

Im a programmer for an university webportal which uses php and msssql.
When an user creates a new entry and his text is too long the entry is cut short and weird characters appear at the end of the entry.

For example:
http://www.ttz.uni-magdeburg.de/scripts/test-messedb/php/index.php?option=show_presse&funktion=presse_show_mitteilung&id=333

How can I set the text limit to unlimited?
Could it be something else?
Is there a way of splitting an entry to several text fields automatically?


Thanks in advance for any help you can give me,
Chris

View 3 Replies View Related

Input In Sql-server Database

Jun 20, 2007

hy, i wrote an input function to put some data in my database with click of button
it doesnt work and i cant find the mistake =/
anyone of you can help?
now theres one thing that isnt right, and that is that the datasiz of messagetext is set to max, and here i put it in to 50, cause dont know how to put it to max cause you can only put in ant integer
, also in the insert into, i did not put all of the columns cause the data i input is only for certain columns, ( don't think thats a problem)
Greetz
Roy1
2 Private mocon As clsAdocon
3 Dim naam As String
4 Dim type As String
5 Dim folder As String
6 Dim sUDL = ConfigurationManager.ConnectionStrings("masterConnectionString").ConnectionString
7
8 Protected Sub btnopslaan_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnopslaan.Click
9
10 folder = "Out"
11 Select Case True
12 Case rdbMail.Checked
13 type = "Mail"
14 Case rdbFax.Checked
15 type = "Fax"
16 Case rdbSms.Checked
17 type = "Sms"
18 End Select
19
20 If type = "Mail" Then
21 Dim strSql As String
22 strSql = "INSERT INTO Message(ToName, ToEmail, Subject, MessageText, TypeBericht, Folder) VALUES(@ToName,@ToEmail,@Subject,@MessageText,@TypeBericht,@Folder);"
23
24 Try
25 'connectie met database
26 Dim objCn As New SqlConnection(sUDL)
27 Dim objCmd As SqlCommand = objCn.CreateCommand()
28 objCmd.CommandText = strSql
29
30 objCmd.Parameters.Add("@ToName", SqlDbType.NVarChar, 50).Value = naam
31 objCmd.Parameters.Add("@ToEmail", SqlDbType.NVarChar, 50).Value = txtAan.Text
32 objCmd.Parameters.Add("@Subject", SqlDbType.NVarChar, 50).Value = txtOnderwerp.Text
33 objCmd.Parameters.Add("@MessageText", SqlDbType.NVarChar, 50).Value = txtbericht.Text
34 objCmd.Parameters.Add("@Folder", SqlDbType.NChar, 10).Value = folder
35 objCmd.Parameters.Add("@TypeBericht", SqlDbType.NChar, 10).Value = type
36
37 objCn.Open()
38 objCmd.ExecuteNonQuery()
39 objCn.Close()
40 Catch ex As Exception
41
42 End Try
43 End If
44
45 End Sub
 

View 4 Replies View Related

Clean Input Before Submitting To Database

Sep 11, 2006

Is there some recommended way to clean input before submitting it to the database? We'd like to develop a library that can be used on our ASP/ASP.NET apps to filter input before it's sent to the SQL Server and Oracle databases. Is there a way to create a .NET DLL that can be used for both ASP.NET and classic ASP apps. Thanks.

View 3 Replies View Related

Want To Compare Webform Input To Database

Apr 9, 2008

 Hello, I am writing a website (in vb) to allow for room use reservations and I am looking for a way to compare the selected start and end times which are date-time format to records already in the database for that  day/time  and specific room.  If the selected time does not fall within an already reserved time frame I then want to insert it into the table.  I have already written a procedure to do the inserting and that works fine.  I just want to validate it before calling the insert.  Any ideas?  The fields to be validated on the form are textboxes containing date time which populate as read only after the time selection is chosen from dropdown. Thanks in advance It's greatly appreciated.

View 7 Replies View Related

Hoe To Input HTML Code In A Database From Asp

Aug 17, 2000

I want to put HTML code in my ASP form and then input in to a database in SQL SERVER 7.0, but due to some syntax problems i can't be able to do it.
Please tell me how i'm gonna input a typical HTML code in Database field.
Thanx.

View 1 Replies View Related

Newbie Trying To Input Data Into Database

Feb 8, 2007

Hello everyone, I am new to mssql so please excuse all my silly questions.

I can create databases and tables. This is fairly easy, now I am having trouble with inputting data into the database using the data entry browser (or whatever it is called to enter data directly into a table).

I usually get an error when trying to submit the entry, firstly I have a "id" field which I think I have set to auto increase (Identity is ticked, seed and increment is set to 1).

when I go to add data all fields have "Null" in them and from what I understand it allows the fields to be empty, except the primary key which is the id field in this case and I expect that to be filled in automatically like with mysql but isn’t.

Can some kind person instruct or direct me somewhere on how to enter data into a table without it failing.

Thanks in advanced for any information provided.

Stealth549

View 2 Replies View Related

The Data On The Website Cannot Be Input In The Server Database..

Mar 6, 2008

hi there..
I have write a code in the submit button using vb code so that when people key in their email.. it will be saved in my created database called test.mdf. but when i debug it, i tried to write an my email address in the textbox in my website but when i click at the submit button, the web page display the email was not enter in my database.
here is the code, can anybody help me. i'm really lost here..
 Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim TestDataSource As New SqlDataSource()TestDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("TestConnectionString1").ToString()
 
TestDataSource.InsertCommandType = SqlDataSourceCommandType.Text
TestDataSource.InsertCommand = "INSERT INTO Email(EmailAddress, IPAddress, DateTimeStamp) VALUES (@EmailAddress,@IPAddress,@DateTimeStamp)"
 TestDataSource.InsertParameters.Add("EmailAddress", emailAddressTextBox.Text)
TestDataSource.InsertParameters.Add("IPAddress", Request.UserHostAddress.ToString())TestDataSource.InsertParameters.Add("DateTimeStamp", DateTime.Now())
 Dim rowsAffected As Integer = 0
 
Try
rowsAffected = TestDataSource.Insert()
 Catch ex As Exception
 Server.Transfer("test_problem.aspx")
 
Finally
 
TestDataSource = Nothing
 
End Try
 
If rowsAffected <> 1 ThenServer.Transfer("test_problem.aspx")
ElseServer.Transfer("Test_Confirm.aspx")
 
End If
 
 
 
End Sub

View 2 Replies View Related

Problem Matching Input Username With Database

Dec 6, 2005

I tried  matching the input username with the database. Although
the input value is the same as the database, but it doesnt goes into
the if statement to increase the "stat" value. Please advise what went
wrong. Thanks.

protected void btnEnter_Click(object sender, EventArgs e)
    {
        if (txtUsername.Text.Length > 0)
        {
            status++;
            Label3.Text = "";
        }
        else
        {
            Label3.Text = "Please enter a username";
        }

        if (txtPassword.Text.Length > 0)
        {
            status++;
            Label4.Text = "";
        }
        else
        {
            Label4.Text = "Please enter a password";
        }
        
        if (status == 2)
        {
            int stat = 0;
            string mySelectQuery = "SELECT * FROM users";
           
SqlConnection myConnection = new SqlConnection("Data
Source=WINSON-COMP;Initial Catalog=winson;Integrated Security=True");
           
SqlCommand myCommand = new SqlCommand(mySelectQuery, myConnection);
            try
            {
                myConnection.Open();
               
SqlDataReader myReader = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    stat = 0;
                   
string user = (string)myReader["username"];
                   
string pass = (string)myReader["password"];
                   
if (user == txtUsername.Text){                       
stat++;
                    }else {
                       
Label3.Text = "Incorrect Username";
                    }
                   
if (pass == txtPassword.Text){
                       
stat++;
                    }else{
                       
Label4.Text = "Incorrect Password";
                    }
                   
if (stat == 2)
                    {
                       
Server.Transfer("shopping.aspx");
                    }
                }
                myReader.Close();
            }
            finally
            {
                myConnection.Close();
            }

        }
    }

View 2 Replies View Related

Query Database User Input From ListBox

Jan 25, 2006

I have a problem selecting fields from a table where fields are equal to user input from a listbox. example
listbox of zip codes:
33023[red]22300[/red]39844[red]29339[/red]23883[red]38228[/red]
user wants to retreive highlight zip codes from database.connection working perfect.Thank you for your help.
 
        

View 2 Replies View Related

Need Input On Trigger Based Database Auditing

Jun 5, 2008

Hi

I am building a pretty simple intranet application where we need to be able to track changes to tables. The tracking feature do not need to be very advanced, we just need to see who changed something and what it was. Therefore I decided just to use a trigger based solution, but need some input/advice since my SQL skills is somewhat lacking.

Consider the following (mock-up) schema:


-- My content table
CREATE TABLE [Content](
[ContentGuid] [uniqueidentifier] NOT NULL PRIMARY KEY DEFAULT (newid()),
[Data] [nvarchar](4000) NOT NULL,
[ChangedBy] [nchar](10) NOT NULL,
[MaybeNull] [int] NULL
)

-- My history table
CREATE TABLE [History](
[ChangedTable] [nvarchar](50) NOT NULL,
[ReferenceGuid] [uniqueidentifier] NOT NULL,
[ChangedBy] [nchar](10) NOT NULL,
[ChangedOn] [datetime] NOT NULL DEFAULT (getutcdate()),
[IsDelete] [bit] NOT NULL DEFAULT ((0)),
[Changes] [xml] NOT NULL
) ON [PRIMARY]

-- My insert/update trigger
CREATE TRIGGER [RecordChangeOnInsertUpdate]
ON [Content]
AFTER INSERT,UPDATE
AS
BEGIN
SET NOCOUNT ON;

DECLARE @Changes xml
SET @Changes = (select * from [inserted] for xml raw ('Content'), elements xsinil)

INSERT INTO [History]
([ChangedTable]
,[ReferenceGuid]
,[ChangedBy]
,[ChangedOn]
,[IsDelete]
,[Changes])
SELECT 'Content', ContentGuid, ChangedBy, getutcdate(), 0, @Changes
FROM [inserted]
END

-- My delete trigger
CREATE TRIGGER [RecordChangeOnDelete]
ON [Content]
AFTER DELETE
AS
BEGIN
SET NOCOUNT ON;

DECLARE @Changes xml
SET @Changes = (select * from [deleted] for xml raw ('Content'), elements xsinil)

INSERT INTO [History]
([ChangedTable]
,[ReferenceGuid]
,[ChangedBy]
,[ChangedOn]
,[IsDelete]
,[Changes])
SELECT 'Content', ContentGuid, ChangedBy, getutcdate(), 1, @Changes
FROM [deleted]
END


I have decided to use the "one history table for all table changes" method. The changes for a row is stored in a xml column which obviously limits the total size of columns in a table being tracked, but that is not a problem in my application. In general I like this set up, since I will be able to change the schema continuously without having to change the triggers, and since the application will probably evolve a lot over the coming months this is pretty important to me.

EDIT: I should add that all the tables I will be tracking have a uniqueidentifier column. This makes it possible to related table rows in the different tables being tracked with their history.

A few concerns with the above SQL:

- Can the inserted/deleted table change between "SET @Changes = (select * ..." and the "INSERT INTO ..." statement, such that the data is not valid? If so, how to work around that?

- If I were to (hypothetically) perform a "UPDATE [Content] SET [Data] = 'something'", not only is my update trigger called once for each row updated, but the XML added to the inserted row in the history table ([History].[Changes]) represent all the rows updated in the batch update. How do I get around this?

Are there any other issues I should be aware of?

Regards, Egil.

View 13 Replies View Related

Update SQL Database Using Excel Sheet As Input

Apr 24, 2007

Hi

I am a very beginner in SQL and know a little bit VB.

I created a database table with two columns, one for key and the other for data. I'd like to update the data column using excel sheet which contains the same columns, key and data.

Does anyone have a sample VB code to share.

Thanks

Al

View 3 Replies View Related

Database Level Setting : Allow User Input Chinese Character~

Jul 16, 2007

Dear all,



To allow users enter chinese character into table, I did try to change the field type to nchar and this is workable. But I have few hundred tables.. Is there anyway to change the setting in easier way? by instead change the field type one by one for each table?



I tried change the collation to Chinese_PRC_90_BIN for the database, but it is not support chinese input..



Any Idea?



Thanks.

View 4 Replies View Related

Retrieving Rows Of Database Values That Have Numbers Cloest To Our Input

Jan 11, 2008



Mean_A Std_Dev_A Mean_B Std_Dev_B Mean_C Std_Dev_C X_Co Y_Co Posn



71.7
9.36
73.23
3.62
70.87
4.06
12
14
1

72.69
8.02
79.39
2.66
73.39
5.16
13
15
2

74.37
10.27
77.33
4.10
79.33
3.44
14
16
3














The Above is my database, I need help in retrieving the X_Co and the Y_Co using values of rcv_A, rcv_B and rcv_C to compare with the Mean_A, Mean_B, Mean_C. The values of rcv_A, rcv_B and rcv_C are instances of values that are not exact of the mean columns , and we want is to compare it against our database and retrieve the row that is the closest to the rcv_A, rcv_B and rcv_C.

Here is an example of what i need. Let's say my rcv_A = 71, rcv_B = 73 and rcv_C = 70.8, so the row with mean value closest would be row 1, followed by row 2, then row 3.

So the result i hope to retrieve is in order of the closest value and i only need the X_Co and Y_Co.
This is what i want

X_Co Y_Co
---------------------------
12 14
13 15
14 16

So anyone please can help me in querying for the above results? Thanks

View 5 Replies View Related

Compare Incoming Input File Row Values With Database Row Values In SSIS

Jan 23, 2008

Hi All,

I receive the input file with some 100 columns and some 20k+ rows and I want to check the incoming input row is existed in the database or not based on 2 key columns. If the row is existed then I need to check all the columns (nearly 100 columns) values in input and the database are equal or not. If both are equal I need to treat them seperately if not there is a seperate logic. How Can I do that check for each row and for each column?

Basically the algorithm is like this, if the input file row is not existed in the database then treat that as new row else if the input row is existed in the database then check all the columns are equal or not. If all the columns are equal then treat that as existing row and do nothing else if some columns are not equal then treat this row seperately.

I found some thing to achieve the above thing.
1. Take the input row and check in the database.
2. If the row is not found in the database then treat it as new row.
3. If row is found in the database then
a) Take the source row and prepare a concatenated string for all the columns
b) Take the database row and prepare a concatenated string for all the columns
c) Find out the hash code for the 2 strings and then compare hash codes for equal.

The disadvantage of this is running a loop 2*m*n times where m is the number of rows and n is the number of columns. It should be done 2 times for input file row and database row.

Can anybody suggest a good method to do this?

What does the function "GetHashCode" for InputBuffer in method "Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)" will do?
Will it generates hash code based on all the columns values?

Pls clarify.

Regards
Venkat.

View 1 Replies View Related

About Field Not Exist In Database

Mar 6, 2008

alo people..
so..this is my question regarding to gridview.. is possible to put the field inside the gridview if it is not exist in the database..
example here is the database:
Name      salaryADAM       30 BOY          50
so right now i want to check their yearly salary..so mysql command will look like thisSELECT NAME,SALARY,SALARY*12 AS YEARLY_SALARYFROM TABLE1;
right now the result of the query will look like thisName      Salary    yearly_salaryADAM      30           360BOY        50           600my question again is, is it possible to put the yearly_salary inside the gridview since it is not originally from the table 1?
ps;/ i;m using vb.net(asp.net) and mysql..and also i use the sqldatasource..  
thanx everyone for the help...

View 3 Replies View Related

Dynamic Field Of Database

Dec 9, 2014

I'm having some troubles with a dynamic field of mine db. The field can change in the length. But I need to change the way it come from the db.

Today it comes like this:
Cod OU | Name OU
10000 Alabama
10100 Olivence
10001 Wraith

I need to change the Code to be like this:

Cod OU* | Name OU
1.00.00 Alabama
1.01.00 Olivence
1.00.01 Wraith

Is it possible?

View 1 Replies View Related

Merge WAN Database (Best Way To Add 1 New Field)

Jul 20, 2005

I have a Database which is Merge Replicated to 5 sitesI need to add 1 new fieldWhat is the best way of doing this ?I have previously removed the publications, subscribers, added thefield and pushed the whole database outPlease adviseRegards Paul

View 2 Replies View Related

Transact SQL :: Return Field When A Field Contains Text From Another Field

Aug 25, 2015

I'm new to SQL and I'm trying to write a statement to satisfy the following:

If [Field1] contains text from [Field2] then return [Field3] as [Field4].

I had two tables where there were no matching keys. I did a cross apply and am now trying to parse out the description to build the key.

View 8 Replies View Related

How To Add Date Field And Time Field (not Datetime Field )

May 4, 2006

Good morning...

I begin with SQL, I would like to add a field that will be date like 21/01/2000.

Actually i find just "datetime" format but give me the format 21/01/2000 01:01:20.

How to do for having date and time in two different field.

Sorry for my english....

Cordially

A newbie

View 3 Replies View Related

Retrive A Binary Field From Database

Nov 15, 2006

hi
I have used the following code (mostly created by MSDN) to retrive a binary field from SQL database. it works but I have extra space between characters. for example if I save a text file with "Hello world" text, after retriving I have it like "H e l l o  w o r l d". what is the problem??????
I am really looking forward your answers
private void retrive()
{
public void a()
{
SqlConnection connection = new SqlConnection("Some Connection string");
SqlCommand command = new SqlCommand("Select * from temp", connection);
// Writes the BLOB to a file
FileStream stream;
// Streams the BLOB to the FileStream object.
BinaryWriter writer;
// Size of the BLOB buffer.
int bufferSize = 50;
// The BLOB byte[] buffer to be filled by GetBytes.
byte[] outByte = new byte[bufferSize];
// The bytes returned from GetBytes.
long retval;
// The starting position in the BLOB output.
long startIndex = 0;
// Open the connection and read data into the DataReader.
connection.Open();
SqlDataReader reader = command.ExecuteReader(CommandBehavior.SequentialAccess);
while (reader.Read())
{
// Create a file to hold the output.
stream = new FileStream(
"C:\file.txt", FileMode.OpenOrCreate, FileAccess.Write);
writer = new BinaryWriter(stream);
// Reset the starting byte for the new BLOB.
startIndex = 0;
// Read bytes into outByte[] and retain the number of bytes returned.
retval = reader.GetBytes(0, startIndex, outByte, 0, bufferSize);
// Continue while there are bytes beyond the size of the buffer.
while (retval == bufferSize)
{
writer.Write(outByte);
writer.Flush();
// Reposition start index to end of last buffer and fill buffer.
startIndex += bufferSize;
retval = reader.GetBytes(0, startIndex, outByte, 0, bufferSize);
}
// Write the remaining buffer.
if (retval != 0)
writer.Write(outByte, 0, (int)retval - 1);
writer.Flush();
// Close the output file.
writer.Close();
stream.Close();
}
// Close the reader and the connection.
reader.Close();
connection.Close();
}
}

View 1 Replies View Related

Using A Database Field In A Session Parameter

Feb 26, 2007

Hi,
I'm using the SQL Datasource control. I want to use a value of a row in a session control parameter.
I have something like this now:
<asp:SessionParameter Name="ArticleType" SessionField="Article_type_" & number_in_gridview />
 number_in_gridview
must be filled with a value in the gridview of the current row.
 Does anybody how to do this ?
Regards,
Vortex

View 1 Replies View Related

Database Design For Status Field

Mar 1, 2007

Hello,
I have a database design question. I want to store a status in a table. In the ASP.NET interface for the user this status will be adapted to the language of the user.
This is how it would look like:
StatusID 1 = "yes" for English, "oui" for French, "ja" for DutchStatusID 2 = "no" for English, "non" for French, "neen" for DutchStatusID 3 = "error" for English, "erreur" for French, "fout" for Dutch
I don't want to do the translation in ASP.NET and it should be done in one query.
How would it look like in the database design.

View 5 Replies View Related

Searching A Database Field For Null Value

Feb 27, 2008

Hi,
I am building a website in ASP.net C# for a university project, and would like to search a table (Member) for a field (UserName) using a session variable Session["sUserName"]. If that field is null, then I would like to insert that session variable into the field to start to create a new user. However, I am getting errors saying that I am using invalid expression terms. My code is;
//Create the Command, passing in the SQL statement and the ConnectionString queryString = "SELECT UserName FROM Member WHERE (UserName = @myUsername); ";
SqlCommand cmd = new SqlCommand(queryString, sqlConn);cmd.Parameters.Add(new SqlParameter("@myUsername", Convert.ToString(Session["sUserName"])));
//If UserName is null, display confirmation, else display errorif (UserName == null) ;
{UserNameCheckLabel.Text = "Username okay";
String queryString = "INSERT INTO Member (UserName) VALUES(@myUsername); ";SqlCommand cmd = new SqlCommand(queryString, sqlConn); cmd.Parameters.Add(new SqlParameter("@myUsername", Convert.ToString(Session["sUserName"])));
}else;
{UserNameCheckLabel.Text = "That username is in use";
}
I have a feeling I should be checking the database for the UserName, but I'm not sure whether to put this in the SELECT statement part or as a method... I would be most grateful for any advice!
Many thanks,
Chima

View 7 Replies View Related

Detecting A Change In A Particular Field In A Database

Nov 16, 2005

Is it possible, using VB code, to retain a user on a particular page
until the status of a certain field in a database is changed?
The scenario I am working on is that a person makes a reservation and
has to wait until that reservation has been accepted or rejected by the
administration.

Dim dsResv As DataSet
        dsResv = objResv.DALgetResvStatus(resvId)

        While (dsResv.Tables(0).Rows(0).Item("resvStatus") = "pending")

            dsResv = objResv.DALgetResvStatus(resvId)

            If
dsResv.Tables(0).Rows(0).Item("resvStatus") = "denied" Then
                failure.Visible = True
                LinkButton1.Visible = True
           
ElseIf dsResv.Tables(0).Rows(0).Item("resvStatus") = "reserved" Then
                success.Visible = True
                LinkButton1.Visible = True
            End If

        End While

This is how I tried to do it, but it doesnt seem to work.
Any suggestions?

View 2 Replies View Related

SQL Server Database (Field Encryption)

Mar 17, 2000

Hi,
Does anyone know how to encrpyt a field in a table created in SQL Server Database.

View 3 Replies View Related

Value From Database To Text Field On Front End

Aug 30, 2002

I need a value in the SQL2000 database to be returned as a text field in the front end.
i.e. value set as '0' or '1' in the database field needs to be returned as 'No' or 'Yes' in the front end.

If anyone can help with this daft query, it would be greatly appreciated.

View 1 Replies View Related

Stored Procedure And A New Database Field

Dec 28, 2007

I am very new to stored procedures and fairly new to SQL in general. I have a stored procedure that looks like this:


CREATE PROCEDURE sp_UpdateProductsTable
@prodName varchar(50),
@prodManufacturer varchar(50),
@prodShortDescrip text,
@prodLongDescrip text,
@prodCatId int,
@prodPrice varchar(6),
@prodSortOrder int,
@prodActive int,
@prodId int
AS
if( @prodId <> 0 )
begin
update Products set
Name = @prodName,
Manufacturer = @prodManufacturer,
ShortDescription = @prodShortDescrip,
LongDescription = @prodLongDescrip,
CategoryID = @prodCatId,
Price = @prodPrice,
SortOrder = @prodSortOrder,
Active = @prodActive
where ID = @prodId;

select ID as prodId from Products where ID = @prodId

end
if( @prodId = 0 )
begin
insert into Products ( Name, Manufacturer, ShortDescription, LongDescription, Price, CategoryID, SortOrder, Active )
values( @prodName, @prodManufacturer, @prodShortDescrip, @prodLongDescrip, @prodPrice, @prodCatId, @prodSortOrder, @prodActive );

SELECT SCOPE_IDENTITY() AS prodId
end

GO



I have recently added two new fields to the database that I need the stored procedure to act upon, but adding them into the above code does not work. I read somewhere that this would happen with new fields, but I do not know how to fix this issue. Could someone point me in the right direction and help me out? I also have some other tables and SP's that I need to update, but its the same issue, I think so fixing this one should help me out across the board.

Thanks in advance for your help.

View 8 Replies View Related

Database Field Length Problem

Jul 20, 2005

Hi everyoneI had an access database running as the source for a website but ithas become too large to run correctly so it has been ported to MS-SQLthe problem is that 4 of the fields were Memo fields in access and assuch are 5000+ characters long each this overflows the allowed size onthe SQL server (8192)Is there a way round without splitting those 4 fields into seperatetales?? as this would cause a truly major re-write of the websiteThanks for any helpFurther details available if required

View 11 Replies View Related

Connecting Variable To Database Field

May 10, 2007



Greetings

what I need to do is access tables in a database, clean up one of the fields and return it to another table in the database. Im using a script component for the transformation whick looks for , or : and replaces : with a decimal point and removes the comma completely. My problem comes with the varaible-- how do I set this up so that the variable read matches the field in the database??



here is the script itself

thanks

km



Public Function AddList(list As String) As String
Dim total As Double
total = 0

If Len(list) > 0 Then
Dim s As Object
s = Split(list, ",")

Dim i As Integer
For i = LBound(s) To UBound(s)
s(i) = Replace(s(i), ":", ".")
total = total + CDbl(s(i))
Next
End If

AddList = total
End Function

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved