
tehon3299
Avatar/Signature-
Posts
156 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by tehon3299
-
Yeah, that works perfectly. Thanks a lot!
-
I'm actually doing that but with an INSERT statement but and I have the quotes exactly the same but if there is a space in the textbox then it just doesn't do the insert statement. Any ideas? Thanks
-
Hey - I have textboxes and I'm inserting the text from the textboxes into an SQL table. The only problem is it screws up when you put a space in any of the textboxes. How can I fix this?? Thanks
-
That works perfect. Now how could I use a variable for the table name?? Thanks
-
OK...Here's the idea. I need to have many people access this web application with different usernames and passwords. Each person is going to have specific data in their table. How would I go about designing this??
-
Well thank you for letting me know this. I am not aware of all the particulars when programming since I am a 19 year old college student just trying to learn Visual Basic and the .NET platform. Thanks
-
Hey - How would I create an SQL table on an ASPX page? If I use: Create Table tbMisc then it say Create is not defined? What's the problem? I have Import Namespace="System.Data.Sqlclient". Any ideas? Thanks
-
Why is this *really* wierd? I want to be able to have user be able to create an account and have an individual table for each user. So when they create their account, they have a GUID associated with their Username and Password. Then I can load their table after they log in.
-
What I need to do is: -Create the GUID -Insert it into an SQL table -Create an SQL table and name it with the GUID So this mean that I would need to create it on the ASPX page, right?? Thanks
-
This is being created on an aspx page and then I am inserting it into an SQL Table.
-
Hey - I am trying to create a GUID in VB.NET. What is the code for this? Is it Dim newGUID as New GUID() Also, how can I insert this value into an SQL table? Thanks
-
OK...I figured it out...In the Sub Page Load function I am clearing the textboxes...I don't know why it screws it up but when I comment it out it inserts it into the table fine. It stills screws up tho when I have a space in the textbox. How can I fix this?? Thanks everyone
-
Good Question. I tried to hard code something and it inserts it fine into the table. Could there be something wrong with the code in my body? Take a look... <body bgcolor="#000000"> <form runat="server"> <font face="helvetica" size="3" color="#aa9933"> <asp:RadioButton Text="Deposit" ID=RadioDeposit GroupName="Radio1" runat="server"></asp:RadioButton> <br><asp:RadioButton Text="Withdrawl" ID=RadioWithdrawl GroupName="Radio1" runat="server"></asp:RadioButton> <br><br>Date:<br><asp:TextBox ID=txtDate name="@Date" runat="server"></asp:TextBox> <br><br>Description:<br><asp:TextBox ID=txtDesc runat="server"></asp:TextBox> <br><br>Amount:<br><asp:TextBox ID=txtAmount runat="server"></asp:TextBox> <br><br><asp:Button ID=SubmitBtn name="SubmitBtn" Text="Submit" OnClick="SubmitBtn_Click" runat="server"></asp:Button> </form> </body> Thanks
-
OK...I did that and my code is below. Still is just inserting blank spaces in the SQL table. Anything else you can see?? <script language="VB" runat="server"> Sub SubmitBtn_Click(sender As Object, e As EventArgs) Dim MyCommand As New SqlCommand Dim MyConnection As New SqlConnection Dim MySQLDataAdapter as New SqlDataAdapter MyConnection = New SqlConnection("server=(local);database=checking;Trusted_Connection=yes") Dim SessionCmd As String = "INSERT INTO tmTransactions (Description) VALUES ('" & txtDesc.Text & "')" MyCommand = New SqlCommand(SessionCmd, MyConnection) MyCommand.Connection.Open() Try MyCommand.ExecuteNonQuery() Catch Exp As SQLException If Exp.Number = 2627 Else End If End Try MyCommand.Connection.Close() End Sub Sub Page_Load(Sender As Object, E As EventArgs) txtDesc.Text = "" txtDate.Text = "" End Sub </script> Thanks
-
I have a problem when inserting data into an SQL table from VB.NET...My code is below. All I get in my SQL table is like spaces. I'm trying to insert data from a textbox to an SQL table. Very simple but I don't know what I am doing wrong. Any suggestions?? <script language="VB" runat="server"> Sub SubmitBtn_Click(sender As Object, e As EventArgs) Dim MyCommand As SqlCommand Dim MyConnection As SqlConnection Dim MySQLDataAdapter as SqlDataAdapter MyConnection = New SqlConnection("server=(local);database=checking;Trusted_Connection=yes") Dim SessionCmd As String = "INSERT INTO tmTransactions (Description) VALUES ('" & txtDesc.Text & "')" MyCommand = New SqlCommand(SessionCmd, MyConnection) MyCommand.Connection.Open() Try MyCommand.ExecuteNonQuery() Catch Exp As SQLException If Exp.Number = 2627 Else End If End Try MyCommand.Connection.Close() End Sub Sub Page_Load(Sender As Object, E As EventArgs) txtDesc.Text = "" txtDate.Text = "" End Sub </script> Thanks
-
SQL Insert Command with Textboxes
tehon3299 replied to tehon3299's topic in Database / XML / Reporting
Yes, I saw that but what would the syntax be for more than one textbox using the same INSERT string? I'm just unsure about the quotes and stuff and where to use them and how to use them. Thanks -
OK - This is probably a pretty straight forward question... What is the syntax of the SQL Insert Command when say you have 2 textboxes that you want to get the data from? i.e. INSERT INTO tableName (columnNames) VALUES (textbox.Text) I know that's not right but it's the right idea. P.S. This is on an ASPX page in .NET Thanks
-
Here ya go:trans.zip
-
Here's my code. I have it in a button click. Can you see what is wrong? It inserts a blank field in SQL but NOT a NULL. I allow NULLS for the field but I just get a blank field.
-
OK...Thanks for the help. Now, where do I use the ExecuteNonQuery() Command? Where does that have to go? Thanks
-
Hey - I was just wondering how I would use the SQL Insert Command on an ASPX page. I know it's: INSERT INTO tableName VALUES ______. How do I use the value from a textbox on the page as the insert value? Thanks
-
Hey - I did that I my code is at the bottom but I had an error with the # so I took it out and it went away. Don't know if I did the right thing. Let me know... myConnection = New SqlConnection("server=(local);database=Pitch;Trusted_Connection=yes") Dim InsertCmd As String = "insert into PitchRecord (Date, Name, Score, Win) values (#" & TodayDate & ", '" & team1 & "'," & team1totPoints & " , 1)" MyCommand = New SqlCommand(InsertCmd, myConnection) MyCommand.Parameters.Add(New SqlParameter("TodayDate", SqlDbType.DateTime, 8)) MyCommand.Parameters("TodayDate").Value = Now() MyCommand.Parameters.Add(New SqlParameter("Name", SqlDbType.NVarChar, 100)) MyCommand.Parameters("Name").Value = team1 'MyCommand.Parameters.Add(New SqlParameter("Score", SqlDbType.NVarChar, 100)) 'MyCommand.Parameters("Score").Value = txtTeam1total.Text 'MyCommand.Parameters.Add(New SqlParameter("Win", SqlDbType.Text, 3000)) 'MyCommand.Parameters("Win").Value = 1 MyCommand.Connection.Open() Try recordsAffected = MyCommand.ExecuteNonQuery() Catch Exp As SqlException If Exp.Number = 2627 Then Else End If End Try MyCommand.Connection.Close() Thanks, Tehon
-
Hey - I was just wondering how to use the SQL Insert Command. I have some code but I do not know how good it is. It doesn't seem to work so I was wondering what the problem was. Heres some of the code: myConnection = New SqlConnection("server=(local);database=Pitch;Trusted_Connection=yes") Dim InsertCmd As String = "insert into PitchRecord (Date, Name, Score, Win) values (TodayDate, team1, team1totpoints, 1)" MyCommand = New SqlCommand(InsertCmd, myConnection) MyCommand.Parameters.Add(New SqlParameter("TodayDate", SqlDbType.DateTime, 8)) MyCommand.Parameters("TodayDate").Value = Now() MyCommand.Parameters.Add(New SqlParameter("Name", SqlDbType.NVarChar, 100)) MyCommand.Parameters("Name").Value = team1 Can someone please give me some insight? Thanks, Tehon
-
Thanks a lot. Works perfect.
-
OK...I'll try that. Thanks a lot.