Solved

asp.net - sample API insert a row into a databasae...

Posted on 2011-03-08
4
379 Views
Last Modified: 2012-05-11
does anyone have a sample API..that will allow a user to insert a row into MS SQL Server DB...in VB.NET...
0
Comment
Question by:GlobaLevel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Anil Golamari earned 500 total points
ID: 35073550
some thing similar to this.

<WebMethod()>
 Public Function samplemethod(ByVal searchvalue As String) As string

Dim connStr As String = "Your connection string"       
Dim cmdTxt As String = "Sql query"
Dim myConn As New System.Data.SqlClient.SqlConnection(connStr)
Dim myCmd As New System.Data.SqlClient.SqlCommand(cmdTxt, myConn)
    Try
        myConn.Open()       
        myCmd.ExecuteNonQuery()
      
           Catch ex As Exception
               ' handle exception
           End Try
      
           If myConn.State = Data.ConnectionState.Open
 Then myConn.Close()
            myConn.Dispose()
           myCmd.Dispose()
      
       End Function
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35074032
good stuff...one quick question...after inserting the value into the db...the web service then retrieves a .mp3 file and returns it to the client and plays automatically thru a media player...is this possible?  thanks in advance...
0
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 35074060
I just want to understand clearly, Here one you insert some data into sql server then your web service has to retrieve a .mp3 file and return it too client right?
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35074168
I just want to understand clearly, Here one you insert some data into sql server then your web service has to retrieve a .mp3 file and return it too client right?

> correct....Im not sure if SQL Server can hold .mp3 files..or if the web server will have to pull it from a file directory off the server and return it to the client...thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question