Wysiwyg Editor Inserting To Database Problems
Jan 25, 2008
Hi, I have a wysiwyg editor - Tinyme, and I've been using this to add text to my database. My problem is that if I use certain kinds of formatting within the editor (for example, I change the font style or strike through the text) it throws an error.
Right now, I'm using:
SqlDataSource1.InsertParameters["MyText"].DefaultValue = TextBox2.Text.ToString();
to insert into my database, but being a different kind of data it doesn't like it. Maybe it would be easier to limit how many features I have on my wysiwyg to eliminate the problem, but i'm not sure how easy that'd be in practice. Any ideas would be great.
mander
View 4 Replies
ADVERTISEMENT
Oct 29, 2007
What you see on the designer is not what you get? How frustrasing can this be when you develop a report? Why did Microsoft made such a deviation from actually designing the windows UI (where you always get what you want and it is a true wysiwyg)
We are doing some data entry apps and would like to simulate a paper based report at the end of the data entry. I designed a portion of it and preview showed what I want. Published the report and found out that the layout is messed up in the IE. I went trough the pain of correcting the layout and made it work for IE. Now when I use the preview the layout is messed up. How can I desgin a layout that works on both worlds. (client side and server side??)
We would like to make the report avaliable in both the windows application(client side) as well as through the report manager (server side)
View 1 Replies
View Related
Jan 17, 2007
I did the following steps:
1. Created a report using SQL Reporting Services. (OK)
2. Deployed the project (ABC) into the ServerX. (OK)
3. Opened the SQL Reporting Services using the Report Manager on localhost of the ServerX. (OK)
4. Opened the ABC folder. Files deployed. (OK)
5. Created two subscriptions. One (Service1) for printing to the Printer. One (Service2) for saving into a file. (OK)
6. Opened the Service1. In the View Tab, after entering the Report Parameters, clicked on "View Report". (OK)
7. I expected view to show what I viewed in the Project (ABC). (NOK - It printed a wrong format. Alignment was completely different)
8. Tried to export to a TIFF file expecting to see the same view as I saw in the Project (ABC). (NOK - It printed a wrong format. Alignment was completely different)
9. Tried to export to a PDF file expecting to see the same view as I saw in the Project (ABC). (NOK - It printed a wrong format. Alignment was completely different)
10. In the subscriptions, I ran the Service1 to print the report from the SQL Reporting Services directly onto the Printer. (NOK - It printed a wrong format. Alignment was completely different)
Is this an expected issue with SQL Reporting Services which incase doesnt make any sense to use it. Or it is an issue with my code. All I assumed that I should expect from SQL Reporting Services is: if I create a Report and I preview the Report, I should get a WYSIWYG formats.
Half the way through our project, we are completely stuck up. SOS!!!
View 1 Replies
View Related
Jan 18, 2007
I did the following steps:
1. Created a report using SQL Reporting Services. (OK)
2. Deployed the project (ABC) into the ServerX. (OK)
3. Opened the SQL Reporting Services using the Report Manager on localhost of the ServerX. (OK)
4. Opened the ABC folder. Files deployed. (OK)
5. Created two subscriptions. One (Service1) for printing to the Printer. One (Service2) for saving into a file. (OK)
6. Opened the Service1. In the View Tab, after entering the Report Parameters, clicked on "View Report". (OK)
7. I expected view to show what I viewed in the Project (ABC). (NOK - It printed a wrong format. Alignment was completely different)
8. Tried to export to a TIFF file expecting to see the same view as I saw in the Project (ABC). (NOK - It printed a wrong format. Alignment was completely different)
9. Tried to export to a PDF file expecting to see the same view as I saw in the Project (ABC). (NOK - It printed a wrong format. Alignment was completely different)
10. In the subscriptions, I ran the Service1 to print the report from the SQL Reporting Services directly onto the Printer. (NOK - It printed a wrong format. Alignment was completely different)
Is this an expected issue with SQL Reporting Services which incase doesnt make any sense to use it. Or it is an issue with my code. All I assumed that I should expect from SQL Reporting Services is: if I create a Report and I preview the Report, I should get a WYSIWYG formats.
Half the way through our project, we are completely stuck up. SOS!!!
View 1 Replies
View Related
Oct 3, 2006
is there some way to access a corrupted database with a text editor so that I can copy over my text database to a new database file? I apparently have corrupted my file headers of both the online database and my backup copy.
Thanks in advance for your help
View 8 Replies
View Related
Oct 12, 2007
Hi,
I drag the database Backup Task from the toolbox and double-click on it, it shows this error:
Cannot show the editor for this task.
Additional information
Method not found: 'Void Microsoft.SQLServer.Management.DatabaseMaintenance.TaskUIUtils..ctor()'.
(Microsoft.SQLServer.MaintenancePlanTasksUI)
What is the prob with this?
cherriesh
View 1 Replies
View Related
Dec 11, 2006
We have a plan to use Microsoft SQL Server 2005 Compact Edition RC1 as a backend. Our Front-end is VS .NET (VB.NET).
We want to know how to edit the Compact Edition database (.SDF). Is there any editor is available right now in the market? or microsoft provided any editor for this.
OR Can i use microsoft 2005 sql server standard edition for this.
Thanks
View 5 Replies
View Related
Jul 23, 2005
Hello,I am trying to update records in my database from excel data using vbaeditor within excel.In order to launch a query, I use SQL langage in ADO as follwing:------------------------------------------------------------Dim adoConn As ADODB.ConnectionDim adoRs As ADODB.RecordsetDim sConn As StringDim sSql As StringDim sOutput As StringsConn = "DSN=MS Access Database;" & _"DBQ=MyDatabasePath;" & _"DefaultDir=MyPathDirectory;" & _"DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" &_"PWD=xxxxxx;UID=admin;"ID, A, B C.. are my table fieldssSql = "SELECT ID, `A`, B, `C being a date`, D, E, `F`, `H`, I, J,`K`, L" & _" FROM MyTblName" & _" WHERE (`A`='MyA')" & _" AND (`C`>{ts '" & Format(Date, "yyyy-mm-dd hh:mm:ss") & "'})"& _" ORDER BY `C` DESC"Set adoConn = New ADODB.ConnectionadoConn.Open sConnSet adoRs = New ADODB.RecordsetadoRs.Open Source:=sSql, _ActiveConnection:=adoConnadoRs.MoveFirstSheets("Sheet1").Range("a2").CopyFromRecordset adoRsSet adoRs = NothingSet adoConn = Nothing---------------------------------------------------------------Does Anyone know How I can use the UPDATE, DELETE INSERT SQL statementsin this environement? Copying SQL statements from access does not workas I would have to reference Access Object in my project which I do notwant if I can avoid. Ideally I would like to use only ADO system andSQL approach.Thank you very muchNono
View 1 Replies
View Related
Aug 10, 2005
is it possible to insert record into second database from a stored procedure which is in first database?
View 1 Replies
View Related
Aug 7, 2007
Hello friends....
I am looking for 2 things(using c#.net or vb.net and sql svr 2000)
1.convert data from sql server 2000 database (say customers table from northwinds database) to a text file(separated by commas or just plain space)
2.Insert the data from text file back to database.
Can someone pls give me the detailed code to achieve this....really need this on urgent basis.......Thank You.
View 10 Replies
View Related
May 8, 2004
Hi Folks,
I have two database. database A, and database B. now I want to insert some recordrs from the table of database A to some table of database B, using "insert" command. Please help me out in this regard.
Please help me.
Thanx.
View 1 Replies
View Related
Dec 6, 2005
hi,
Need to insert .wav or mp3 file into sql server.I need to store maximum of 2 or 3 min of file into the database.which format would the best storing as .wav or .mp3.I think storing mp3 in blob data would be best.Pl. give suggestion which would be of much help to me.
Thanks in advance
karuna
View 7 Replies
View Related
May 1, 2012
I have two databases im working with, one is our public database GRM_Public, and the other is our production database GRM_Prod.
I'm trying to import data from a field called 'oldscreencodes1' from GRM_Prod.Transfer table into a field called 'Sale1Type' in GRM_Public.Real_land table.
For some reason I can't get this to work, I have in the past imported datatables from our production DB to our public DB by using 'insert into' but I've never inserted data into a single field within a datatable and I think I'm over thinking this process.
Is a 'join' necessary in order to accomplish this?
View 6 Replies
View Related
Oct 30, 2006
hey everyone,I have created two tables in an sql server database. I have a check box in the table 1, and when it is checked, I want to insert that particular record into table 2. (By the way I am using a datagrid) The problem is when I click the check on the particular record I want inserted, and click update, the system copies the record twice instead of once. When I look into table 2, I end up having two of the same records. Can anyone help me.
View 4 Replies
View Related
Apr 24, 2007
I am using visual devloper express, and i have been following allow in the "starter videos". for lesson 8, the example worked fine, but when i try to replicate the example with a SQL database (external one) when I am configuring the formView, and i try to click the advanced tab under 'Advanced SQL Generation Options", I do not have the abilty to check the 2 boxes for generate insert, update, delete statements, etc (they are greyed out).
i have an asp page that has the same connection as this page and i am able to insert a record, so i am sure it's not a permission thing...
I don't understand what I am doing wrong here... a plain old asp coded page inserts records into this table in the same database, but I am unable to check the boxes for "generate insert" etrc, and the error I get on the page itself is
Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NotSupportedException: Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.
View 1 Replies
View Related
Jun 5, 2007
I try to make something or set an option, which would generate next values of the id of some table (id is primary key) while inserting a row to the table. I used once a sequence for Oracle database and wonder if there is something similar in .Net for "standard" database (Add new item -> SQL Database). I'm using SqlDataSources.Is Repeater a component that would be useful here? Or shall i write a function that would generate ids manually?Thanks in advance
View 2 Replies
View Related
Aug 19, 2007
Hello all, I'm very new to web development and I have hit a snag in my project that I am hoping someone can help me with. I am trying to allow users to upload photos into my database using the formview control and the fileupload control. I have specified the data type as image, but when I try to upload a photo or just pass a null value I get the following error. Operand type clash: sql_variant is incompatible with image Does anyone know why this might be? Thanks very much. Matt Downey
View 3 Replies
View Related
Oct 30, 2007
Hello everyone,
I am having some problems inserting some data into a database - I have been stuck on this almost all day now and I'm almost pulling my hair out! I'm quite new to ASP.net and have been thrown in the deep end with this assignment... And advice or help would be greatly appreciated. Thanks.
Protected Sub CreateUserWizard1_CreatedUser1(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser
'Assign new user to role of Applicant
Roles.AddUserToRole(CreateUserWizard1.UserName, "Applicant")
'Create Connection String
UserName = CreateUserWizard1.UserName
Dim DBConn As New SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;User Instance=True")
Dim DBCmd As New SqlCommand
DBConn.Open()
'Add Insert Statement
DBCmd = New SqlCommand("INSERT INTO aspnet_Users(MobileAlias) VALUES (@Applicant) WHERE UserName=@UserName", DBConn)
'Add Database Parameters
DBCmd.Parameters.Add("@Applicant", SqlDbType.NVarChar).Value = "Applicant"
DBCmd.ExecuteNonQuery()
'Close Database connection
'and Dispose Database objects
DBCmd.Dispose()
DBConn.Close()
DBConn = Nothing
End Sub
---------------------------------------------------------------------------------
error generated:
Incorrect syntax near the keyword 'WHERE'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'.
View 5 Replies
View Related
Feb 28, 2008
Hi iam working with the form which has fields like AuditName,Industry Name,Company Name,Plant Name,Group Name,AuditStartedOn,Auditperiod upto,CreatedOn,createdby
I have dropdownlists for Industry Name,Company Name,Plant Name,Group Name.Data will be filled into Industry Name,Group Name when pageloads from the database and later depending on industryname company name and depending on company name plant name ddl's wiil be filled.
Later to insert this into the Audit table i had given the Stored procedure as :
create procedure CreateAudit
(
@AuditName nvarchar(50),
@IndustryName nvarchar(50),
@IndustryID int output,
@CompanyName nvarchar(50),
@CompanyID int output,
@PlantName nvarchar(50),
@PlantID int output,
@GroupName nvarchar(50),
@GroupID int output,
@AuditStartedOn datetime,
@AuditScheduledto datetime,
@CreatedOn datetime,
@CreatedBy int
)
as
begin
//Here iam getting the Id of the industryname selected in the ddl from industry table into an output parameter @IndustryID
select @IndustryID=Ind_Id_PK from Industry where Industry_Name=@IndustryName
//Here iam getting the Id of the companyname selected in the ddl from company table into an output parameter @CompanyID
select @CompanyID=Cmp_ID_PK from Company where Company_Name=@CompanyName
//Here iam getting the Id of the plantname selected in the ddl from plant table into an output parameter @PlantID
select @PlantID=Pl_ID_PK from Plant where Plant_Name=@PlantName
//Here iam getting the Id of the Groupname selected in the ddl from Group table into an output parameter @GroupID
select @GroupID=G_ID_PK from Groups where Groups_Name=@GroupName
Insert into Audits(Audit_Name,Audit_Industry,Audit_Company,Audit_Plant,Audit_Group,Audit_Started_On,Audit_Scheduledto,Audit_Created_On,Audit_Created_By)values(@AuditName,@IndustryID,@CompanyID,@PlantID,@GroupID,@AuditStartedOn,@AuditScheduledto,@CreatedOn,@CreatedBy)
end
Later called these parameters into class file:
namespace xyz{
public class clsCreateAudit
{SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["constr"]);
SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter();public clsCreateAudit()
{
con.Open();
}public void CreateAudit(string Audit_Name, int Audit_Industry, int Audit_Company, int Audit_Plant, int Audit_Group, DateTime Audit_Started_On, DateTime Audit_Scheduledto, DateTime Audit_Created_On, string Audit_Created_By)
{
cmd.Connection = con;cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "CreateAudit";
SqlParameter AuditName = new SqlParameter();AuditName.ParameterName = "@AuditName";AuditName.DbType = DbType.String;
AuditName.Value = Audit_Name;AuditName.Direction = ParameterDirection.Input;
cmd.Parameters.Add(AuditName);
SqlParameter AuditIndustry = new SqlParameter();AuditIndustry.ParameterName = "@IndustryName";AuditIndustry.Direction = ParameterDirection.Input;
AuditIndustry.Value = Audit_Industry;AuditIndustry.DbType = DbType.String;
cmd.Parameters.Add(AuditIndustry);
SqlParameter IndustryID = new SqlParameter();IndustryID.ParameterName = "@IndustryID";
IndustryID.Direction = ParameterDirection.Output;IndustryID.DbType = DbType.Int32;
//IndustryID.Size = 100;
cmd.Parameters.Add(IndustryID);SqlParameter AuditCompany = new SqlParameter();
AuditCompany.ParameterName = "@CompanyName";AuditCompany.Direction = ParameterDirection.Input;
AuditCompany.Value = Audit_Company;AuditCompany.DbType = DbType.String;
cmd.Parameters.Add(AuditCompany);SqlParameter CompanyID = new SqlParameter();
CompanyID.ParameterName = "@CompanyID";CompanyID.Direction = ParameterDirection.Output;
CompanyID.DbType = DbType.Int32;
//IndustryID.Size = 100;
cmd.Parameters.Add(CompanyID);
SqlParameter AuditPlant = new SqlParameter();
AuditPlant.ParameterName = "@PlantName";AuditPlant.Direction = ParameterDirection.Input;
AuditPlant.Value = Audit_Plant;AuditPlant.DbType = DbType.String;
cmd.Parameters.Add(AuditPlant);SqlParameter PlantID = new SqlParameter();
PlantID.ParameterName = "@PlantID";PlantID.Direction = ParameterDirection.Output;
PlantID.DbType = DbType.Int32;
//IndustryID.Size = 100;
cmd.Parameters.Add(PlantID);SqlParameter AuditGroup = new SqlParameter();
AuditGroup.ParameterName = "@GroupName";AuditGroup.Direction = ParameterDirection.Input;
AuditGroup.Value = Audit_Group;AuditGroup.DbType = DbType.String;
cmd.Parameters.Add(AuditGroup);SqlParameter GroupID = new SqlParameter();
GroupID.ParameterName = "@GroupID";GroupID.Direction = ParameterDirection.Output;
GroupID.DbType = DbType.Int32;
//IndustryID.Size = 100;
cmd.Parameters.Add(GroupID);SqlParameter AuditStartedOn = new SqlParameter();
AuditStartedOn.ParameterName = "@AuditStartedOn";AuditStartedOn.Direction = ParameterDirection.Input;
AuditStartedOn.Value = Audit_Started_On;AuditStartedOn.DbType = DbType.String;
cmd.Parameters.Add(AuditStartedOn);SqlParameter AuditScheduledto = new SqlParameter();
AuditScheduledto.ParameterName = "@AuditScheduledto";AuditScheduledto.Direction = ParameterDirection.Input;
AuditScheduledto.Value = Audit_Scheduledto;AuditScheduledto.DbType = DbType.String;
cmd.Parameters.Add(AuditScheduledto);SqlParameter CreatedOn = new SqlParameter();
CreatedOn.ParameterName = "@CreatedOn";CreatedOn.Direction = ParameterDirection.Input;
CreatedOn.Value = Audit_Created_On;CreatedOn.DbType = DbType.String;
cmd.Parameters.Add(CreatedOn);SqlParameter CreatedBy = new SqlParameter();
CreatedBy.ParameterName = "@CreatedBy";CreatedBy.Direction = ParameterDirection.Input;
CreatedBy.Value = Audit_Created_By;CreatedBy.DbType = DbType.Int32;
cmd.Parameters.Add(CreatedBy);
cmd.ExecuteNonQuery();
con.Close();
}
}
}
Then i called these function into .aspx.cs file:
using xyz;protected void btn_CreateAudit_Click(object sender, EventArgs e)
{SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["constr"]);
PCRA.clsCreateAudit obj = new PCRA.clsCreateAudit();
SqlCommand cmd = new SqlCommand();
//Iam getting the Session(UID) from my login page.obj.CreateAudit(txt_AuditName.Text, Convert.ToInt32(ddl_Industry.SelectedItem.Value), Convert.ToInt32(ddl_Company.SelectedItem.Value), Convert.ToInt32(ddl_Plant.SelectedItem.Value), Convert.ToInt32(ddl_Group.SelectedItem.Value), Convert.ToDateTime(txt_StartingOn.Text.ToString()), Convert.ToDateTime(txt_AuditPeriod.Text.ToString()), System.DateTime.Now, Session["UID"].ToString());lbl_Mesg.Text = "Your Audit Details are added succesfully";
}
But iam getting an error here near obj.CreateAudit as:
Input string was not in a correct format.
I even want to know if my storedprocedure reaches the requirement which i specified.
please help me with this.Its very urgent.
View 1 Replies
View Related
Mar 7, 2008
I have a page called 'upload.vb', which is the code for a file upload project I am working on. I am trying to write the filenames to an SQL database that I have built, but I keep getting this error: Compiler Error Message: BC30201: Expression expected. It doesn't seem to like the @ on line 46 in the VALUES part of my INSERT statement. Can anybody shed any light on this. Thanks. 1 Imports System
2 Imports System.Data
3 Imports System.Configuration
4 Imports System.Web
5 Imports System.Web.Security
6 Imports System.Web.UI
7 Imports System.Web.UI.WebControls
8 Imports System.Web.UI.WebControls.WebParts
9 Imports System.Web.UI.HtmlControls
10 Imports System.IO
11 Imports System.Data.SqlClient
12
13 ''' <summary>
14 ''' Upload handler for uploading files.
15 ''' </summary>
16 Public Class Upload
17 Implements IHttpHandler, IReadOnlySessionState
18
19 Public Sub New()
20 End Sub
21
22 #Region "IHttpHandler Members"
23
24 Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
25 Get
26 Return True
27 End Get
28 End Property
29
30
31
32 Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
33
34 If context.Request.Files.Count > 0 Then
35 ' get the applications path
36 Dim tempFile As String = context.Request.PhysicalApplicationPath
37 ' loop through all the uploaded files
38 Dim j As Integer = 0
39 While j < context.Request.Files.Count
40 ' get the current file
41 Dim uploadFile As HttpPostedFile = context.Request.Files(j)
42 ' if there was a file uploded
43 If uploadFile.ContentLength > 0 Then
44
45 uploadFile.SaveAs(String.Format("{0}{1}{2}", tempFile, "Uploads", uploadFile.FileName))
46 SqlDataSource.InsertCommand = "INSERT INTO tblDocuments(TheFileName) VALUES ('" & @TheFileName & "')"
47
48 End If
49 System.Math.Max(System.Threading.Interlocked.Increment(j), j - 1)
50 End While
51 End If
52 ' Used as a fix for a bug in mac flash player that makes the
53 ' onComplete event not fire
54 HttpContext.Current.Response.Write(" ")
55 End Sub
56 #End Region
57
58 End Class
View 10 Replies
View Related
Apr 15, 2008
hi everyone i was wondring if anyone could help me please! i used this code the other day and it was working fine, but then i put this required field validator in and now the sqldatasource is only inserting null values into my database! can someone help me out PLEASE!!!<SCRIPT runat="server">Private Sub InsertVote(ByVal Source As Object, ByVal e As EventArgs)SqlDataSource1.Insert()End Sub </SCRIPT><form id="form1" runat="server"> Please can you enter your Account ID into the box below, then select the party you wish to vote for by clicking the down arrow and navigatinging to the party of your choice then click the Submit button.<br /> <br />Account ID: <asp:TextBox id="TextBox1" runat="server"/> <br /> <asp:RequiredFieldValidator ID="Validator1" ControlToValidate="TextBox1" ErrorMessage="Please enter your account number" runat="server" /> <br /> <br />Party Selection: <asp:dropdownlist id="Dropdownlist1" runat="server" datasourceid="SqlDataSource1" datatextfield="Party" AppendDataBoundItems="true"><asp:ListItem Value="" Text="Please Select"/></asp:dropdownlist> <br /><asp:RequiredFieldValidator ID="Validator2" ControlToValidate="Dropdownlist1"ErrorMessage="Please can you select the party you wish to vote for" runat="server"/><br /><asp:sqldatasourceid="SqlDataSource1"runat="server" selectcommand="SELECT Party.Party FROM Party"insertcommand="INSERT INTO Vote(AccountId,Vote) VALUES (Account,Vote)" ConnectionString="<%$ ConnectionStrings:VotingConnectionString %>" ProviderName="<%$ ConnectionStrings:VotingConnectionString.ProviderN ame %>"><InsertParameters><asp:FormParameter Name="Account" Type="String" FormField="AccountNumber" /> <asp:FormParameter Name="Party" Type="String" FormField="PartyList" /></InsertParameters> </asp:sqldatasource> <br /><asp:button id="Button1" runat="server" text="Submit" onclick="InsertVote"/> </form>
View 2 Replies
View Related
Apr 25, 2008
hi is it possible to insert a session into a database E.G. i'm sure this code is fine but i duno why its not inserting the session into the database the form parameter is going in fine but the session aian't
UserName.Text = Session("User")<asp:sqldatasource id="SqlDataSource1" runat="server"
selectcommand="SELECT Party.Party FROM Party"
insertcommand="INSERT INTO Vote(UserName,Vote) VALUES (User,Party)"
ConnectionString="<%$ ConnectionStrings:VotingConnectionString %>"
ProviderName="<%$ ConnectionStrings:VotingConnectionString.ProviderName %>">
<InsertParameters>
<asp:SessionParameter Name="User" Type="String" SessionField="User" />
<asp:FormParameter Name="Party" Type="String" FormField="PartyList" />
</InsertParameters>
</asp:sqldatasource>
View 7 Replies
View Related
Dec 6, 2004
ok i've got several pages that insert with no problem but this one is giving me fits. The query it's generated works, because i've plugged it into the database through access and it worked. here is my code what am i doing wrong? It opens the connection and then gets to the executeNonQuery and doesn't do it not sure why.
Dim sqlInsert As String
Dim ssn As String
Dim ssnDash As String
Dim mma As String
Dim position As String
Dim subject As String
Dim mmaCheck As String
Dim subjectCheck As String
Dim bothCheck As String
Dim otherCheck As String
Dim flag As Boolean = False
Dim added As Boolean = False
Try
If txtSSN.Text <> "" Then
ssn = txtSSN.Text
ssnDash = ssn.Substring(0, 3) & "-" & ssn.Substring(3, 2) & "-" & ssn.Substring(5, 4)
End If
mma = dlMMA.SelectedValue.ToString
position = dlPosition.SelectedValue.ToString
subject = dlMajor.SelectedValue.ToString
Catch ex As Exception
Response.Write("Please fill in all fields")
End Try
otherCheck = mma & subject
Dim dr As DataRow
For Each dr In dsMajor.Tables("List_Of_MMA").Rows
If mma = dr.Item("mma").ToString And subject = dr.Item("Subject").ToString Then
mmaCheck = dr.Item("MMA").ToString
subjectCheck = dr.Item("Subject").ToString
flag = True
bothCheck = mmaCheck & subjectCheck
End If
Next
If flag = False Then
Response.Write("Didn't Work")
Else
sqlInsert = "INSERT INTO Student_Major(SSN, MMA, Subject, Position) Values('"
sqlInsert += ssnDash & "','"
sqlInsert += mmaCheck & "','"
sqlInsert += subjectCheck & "','"
sqlInsert += position & "')"
Dim com As OleDbCommand = New OleDbCommand(sqlInsert, myConnection)
Try
myConnection.Open()
com.ExecuteNonQuery()
added = True
Catch ex As Exception
Response.Write(sqlInsert)
Finally
myConnection.Close()
End Try
'If added = True Then
Response.Write("New Major, Minor, or Area added: " & subject)
'End If
End If
View 6 Replies
View Related
Dec 7, 2004
here is what happens..... i create a sql statement with a date parameter and execute the insert via my asp.net page.
strsql = "insert into table(id, lastdate, id2) values ('id'," & date.today & ",'id2')"
this produces the following date in my database which is 'smalldate' datatype = 1/1/1900
View 3 Replies
View Related
Apr 26, 2005
i have a page writing to a dsatabase. this is the string
<code>
cmd = new sqlcommand("insert into company_locations (company_id, location_type, location_name, contact, address, suite, address2, city, state, zip, phone, extension, fax, comments) Values ('" & provider_id & "', '" & location_type.selectedvalue & "', '" & location_name.text & "', '" & contact.text & "', '" & address.text & "', '" & suite.text & "', '" & address2.text & "', '" & city.text & "', '" & states.selecteditem.value & "', '" & zip.text & "', '" & phone.text & "', '" & extension.text & "', '" & fax.text & "', '" & comments.text & "')", xDb_Conn_Str)
</code>
the problem is that in location_name, I am allowing ' as a valid character. Can anyone help me with this. everytime i execute my statement is truncated because of '.
thanks
View 3 Replies
View Related
Oct 13, 2005
Hi,Recently I was asked to insert images into the database as a part of my module,can someone help me out on this, How can I insert images and retrieve the same from databaseSandhya
View 1 Replies
View Related
Mar 12, 2007
I am currently trying to import CSV files into a sql database table. While I have managed to get the majority of the import to work, some of the records are failing to import due validation errors. What I would like to know is, is it possible to separate out the records that failed to import from the CSV file? The CSV file is quite large so I am unable to locate these records by hand. Thanks
View 7 Replies
View Related
Apr 9, 2008
I have table in my SQL db
I am inserting value using insert statement
Following are statement which I am using when inserting data into database
INSERT INTO EMPLOYEE (NAME, TELEPHONE, PINNUM,CELLNUM)
SELECT NAME,TELEPHONE,PINNUM FROM EMPLOYEE WHERE EMPLOYEEID=1
Noticed that I dont have CELLNUM In my select statment, but I want to insert that number from textbox which I have on my webform.
can some one tell me how do i do this query so i can insert data into database.
HELP ME
thank u
maxs
View 6 Replies
View Related
May 13, 2007
Hi, how do I go about inserting image into the SQL Compact Edition Database? This is something similar to the Photo Column in the Employees Table in Northwind Database.
I have set the Photo Column properties as 'image', but all that appears is a white icon with a red x. How do I change this to my own image?
View 10 Replies
View Related
Jul 10, 2007
hello everyone
I have a question about new record insertion. I have a SQL Database that I have cofigured as a publisher for a mobile database. I want to be able using the PDA to insert new Customers and synchronize the CE database with the SQL DB. But I encounter a problem with the column field rowguid that SQL inserts as a unique indentifier during the publication. It cannot accept null values and I can't insert a value using the keyboard since the value is generated by SQL.
So my impression is that you cannot use PDA to insert new records, only to update old ones. Is that true or I miss something??
If someone knows the answer please let me know.
Thank you in advanced.
View 8 Replies
View Related
Sep 26, 2006
Here's the error I get trying to run the code posted below..."Prepared statement '(@datestamp datetime,@PrevValue real,@NewValue real,@IPaddress r' expects parameter @datestamp, which was not supplied."I've tried it without the quotes around the DateTime.Now and also adding the # around them. Without the quotes, I do get a different error because it doesn't like the spaces in the DateTime text. Also, the datestamp data in the database is formatted as a datetime (MS SQL Server 2005).Here's my code:Private Sub UpdateRefresh()UpdateConnection.Open()UpdateDataAdapter.InsertCommand.CommandText = "INSERT INTO dbo.tbDeploy(datestamp," & _"PrevValue, NewValue, IPaddress, HighCapability, LowCapability, Share) VALUES" & _"('" & DateTime.Now & "', '" & lblCurrent.Text & "', '" & lblCurrent.Text & _"', '" & lblIP.Text & "', '" & lblHigh.Text & "', '" & lblLow.Text & "', '" & lblShare.Text & "')"UpdateDataAdapter.InsertCommand.ExecuteNonQuery()UpdateConnection.Close()End Sub
View 1 Replies
View Related
Oct 15, 2006
my requirment is insert TableName and JourneyDate and FlightNumber alongwith otherdata at RunTime but i get error, I tried it several times. Table Structure is: Create Table HA142
(
JourneyDate DateTime primary key,
FlightNo char(5)not null FOREIGN kEY REFERENCES FLIGHTS(FlightNo),
FirstClassSeatAvalable int,
BusinessClassSeatAvalable int,
EconomyClassSeatAvalable int,
FsWaitingAvalable int,
BsWaitingAvalable int,
EcWaitingAvalable int
) string flightno = drpFlightNo.SelectedItem.Text;
string JourneyDate = Session["JourneyDate"].ToString();
string newStrign = ",18,42,280,3,7,35)";
SqlConnection myConn = new SqlConnection("workstation id=JASIM;packet size=4096;user id=ASPNET;data source=JASIM;persist security info=False;initial catalog=Test");
SqlCommand populateFlightTable = new SqlCommand("INSERT INTO "+flightno+" VALUES("+JourneyDate+","+flightno+newStrign,myConn);
myConn.Open();
populateFlightTable.ExecuteNonQuery();
myConn.Close(); whenever compiler reached to populateFlightTable.ExecuteNonQuery(); I received error. i tried it to rectify several times but no result.plz hemp me...
View 3 Replies
View Related
Mar 24, 2007
Hello,
Could someone give me the code for inserting an image into the database. I have the field declared in my table. And the image needs a type value because it receives the message "nvarchar is incompatible with image"
Thanks
View 1 Replies
View Related